shariq
IndividualForum Replies Created
-
shariq
MemberSeptember 16, 2018 at 9:46 am in reply to: Name important annotations used in JAX-RS API in SalesforceHi,
I found this online :-
- The @Path Annotation and @PathParam
- The @QueryParamter Annotation
- The @Produces Annotation
- The @Consumes Annotation
- The @FormParam Annotation
- The @MatrixParam Annotation
- The @CookieParam Annotation
- The @HeaderParam Annotation
- The @Provider Annotation
Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 9:44 am in reply to: What is the use of the invocable method annotation in Salesforce?Hi,
To add more -
There can be at most one input parameter and its data type must be one of the following:
- A list of a primitive data type or a list of lists of a primitive data type – the generic Object type is not supported.
- A list of an sObject type or a list of lists of an sObject type – the generic sObject type is not supported.
- A list of a user-defined type, containing variables of the supported types and with the InvocableVariable annotation. Create a custom global or public Apex class to implement your data type, and make sure your class contains at least one member variable with the invocable variable annotation.
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 9:34 pm in reply to: What are the primary security issues with web services in Salesforce?Hi,
To add more -
Disadvantages
- Although the simplicity of Web services is an advantage in some respects, it can also be a hindrance. Web services use plain text protocols that use a fairly verbose method to identify data. This means that Web service requests are larger than requests encoded with a binary protocol. The extra size is really only an issue over low-speed connections, or over extremely busy connections.
- Although HTTP and HTTPS (the core Web protocols) are simple, they weren't really meant for long-term sessions. Typically, a browser makes an HTTP connection, requests a Web page and maybe some images, and then disconnects. In a typical CORBA or RMI environment, a client connects to the server and might stay connected for an extended period of time. The server may periodically send data back to the client. This kind of interaction is difficult with Web services, and you need to do a little extra work to make up for what HTTP doesn't do for you.
- The problem with HTTP and HTTPS when it comes to Web services is that these protocols are "stateless"—the interaction between the server and client is typically brief and when there is no data being exchanged, the server and client have no knowledge of each other. More specifically, if a client makes a request to the server, receives some information, and then immediately crashes due to a power outage, the server never knows that the client is no longer active. The server needs a way to keep track of what a client is doing and also to determine when a client is no longer active.
- Typically, a server sends some kind of session identification to the client when the client first accesses the server. The client then uses this identification when it makes further requests to the server. This enables the server to recall any information it has about the client. A server must usually rely on a timeout mechanism to determine that a client is no longer active. If a server doesn't receive a request from a client after a predetermined amount of time, it assumes that the client is inactive and removes any client information it was keeping. This extra overhead means more work for Web service developers.
Hope this helps.
-
Hi,
The Java API for XML Web Services (JAX-WS) is a Java programming language API for creating web services, particularly SOAP services. JAX-WS is one of the Java XML programming APIs.
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 9:23 pm in reply to: What are the advantages of web services in Salesforce?Hi,
Advantages
Web Services offer many benefits over other types of distributed computing architectures.
- Interoperability - This is the most important benefit of Web Services. Web Services typically work outside of private networks, offering developers a non-proprietary route to their solutions. Services developed are likely, therefore, to have a longer life-span, offering better return on investment of the developed service. Web Services also let developers use their preferred programming languages. In addition, thanks to the use of standards-based communications methods, Web Services are virtually platform-independent.
- Usability - Web Services allow the business logic of many different systems to be exposed over the Web. This gives your applications the freedom to chose the Web Services that they need. Instead of re-inventing the wheel for each client, you need only include additional application-specific business logic on the client-side. This allows you to develop services and/or client-side code using the languages and tools that you want.
- Reusability - Web Services provide not a component-based model of application development, but the closest thing possible to zero-coding deployment of such services. This makes it easy to reuse Web Service components as appropriate in other services. It also makes it easy to deploy legacy code as a Web Service.
- Deployability - Web Services are deployed over standard Internet technologies. This makes it possible to deploy Web Services even over the fire wall to servers running on the Internet on the other side of the globe. Also thanks to the use of proven community standards, underlying security (such as SSL) is already built-in.
Hope this helps.
- Interoperability - This is the most important benefit of Web Services. Web Services typically work outside of private networks, offering developers a non-proprietary route to their solutions. Services developed are likely, therefore, to have a longer life-span, offering better return on investment of the developed service. Web Services also let developers use their preferred programming languages. In addition, thanks to the use of standards-based communications methods, Web Services are virtually platform-independent.
-
shariq
MemberSeptember 15, 2018 at 9:11 pm in reply to: What is Command Line DataLoader in Salesforce?Hi,
In addition to using Data Loader interactively to import and export data, you can run it from the command line. You can use commands to automate the import and export of data.
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 9:10 pm in reply to: What are the differences between the Import Wizard and Apex Data Loader in Salesforce?Hi,
Import Wizard:
For simple imports of up to 50000 records.
It supports all custom objects and only few standard objects like Account, Contact, Leads, Solution.
It supports schedule export.
Delete operation is not available.
We cannot export data.
It doesn’t require installation.
While importing, duplicates can be ignored.Data Loader:
For complex imports of any size more than 50000 records.
It supports all standard and custom objects.
It doesn’t support schedule export.
Delete operation is available.
We can export data of all custom & standard objects, and can import all custom & standard objects except User standard object.
It requires installation.
While importing, duplicates cannot be ignored.Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 9:09 pm in reply to: Difference between Data Import Wizard and Data Loader in Salesforce?Hi,
Import Wizard is designed for less-technical users and smaller, simple imports of up to 50,000 records. It is a step by step process and displays error messages to alert the potential record duplications (“dupes”).
Apex Data Loader is used for complex imports of any size. It doesn’t display error messages to alert the potential problems. This tool includes several features that help in making large data imports easier.
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 9:07 pm in reply to: What purpose does Junction objects serve in salesforce?Hi,
Reason :-
You can't create many to many relationship in salesforce with two sobjects, you have to take a third sobject as junction between the first two.
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 9:05 pm in reply to: Why Salesforce Future Methods returns only void type?Hi,
The @future methods can only have primitive data types (or collections of them) for their input parameters. As they run at a future time from when they are called, they have nowhere to return a response and thus can only return a void type. Other than this and the fact that there is a limit as to how many future methods can be invoked at any one time, they look and behave like any other method.
Future methods will run in the future. You don't want your synchronous code waiting an unknown period of time for an asynchronous bit of code to finish working.
Hope this helps.
-
Hi,
OAuth 2.0 is an authorization framework for delegated access to APIs. It involves clients that request scopes that Resource Owners authorize/give consent to. OAuth is not an authentication protocol. OpenID Connect extends OAuth 2.0 for authentication scenarios and is often called “SAML with curly-braces”
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 6:28 pm in reply to: How to integrate one SFDC org to another SFDC using Rest API?Hi,
One of the ways to Integrate two Salesforce Instances will be using oauth for session management and using REST API
Lets Assume you have SalesforceA as Source ORG and SalesforceB as Destination ORG .Now lets assume flow of data is from SalesforceA to SalesforceB Instance
1)For oauth 2.0 in Destination org(SalesforceB) create a Connected App .To help you configure the Connected App in Destination below screenshot should assist.Callback Url may not be of any significant as we are using User-Name Password flow model.You will obtain client secret,consumer key in this process and one should store in Source org custom object or custom setting
2)In your source org create a Remote site settings with url as the URL of the Destination Instance
3)Create a Integration User in the Destination org whose credentials you will use to call API from Salesforce Source ORG
4)Use the username,password and security token(Also i would prefer setting password never expires here for integration User) and also client secret and consumer key in a custom object or custom setting (Protected) in Source org.
The below code is sample code to get authenticated and how to use access token to further make any API call-
Settings__c ts=settings;//Here write a sample query or fetch from custom settings the consumer ,client secret and username and password of destination org
String clientId = ts.ConsumerKey__c;
String clientSecret = ts.Client_Secret__c;
String username=ts.Username__c;
String password=ts.Password__c+ts.SecurityToken__c;String reqbody = 'grant_type=password&client_id='+clientId+'&client_secret='+clientSecret+'&username='+username+'&password='+password;
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setBody(reqbody);
req.setMethod('POST');
req.setEndpoint(ts.URL__c+'/services/oauth2/token');//Note if my domain is set up use the proper domain name else use login.salesforce.com for prod or developer or test.salesforce.com for sandbox instanceHttpResponse res = h.send(req);
OAuth2 objAuthenticationInfo = (OAuth2)JSON.deserialize(res.getbody(), OAuth2.class);
RequestWrapper reqst=new RequestWrapper();if(objAuthenticationInfo.access_token!=null){
Http h1 = new Http();
HttpRequest req1 = new HttpRequest();
req1.setHeader('Authorization','Bearer '+objAuthenticationInfo.access_token);
req1.setHeader('Content-Type','application/json');
req1.setHeader('accept','application/json');req1.setBody(jsonstr);//Send JSON body
req1.setMethod('POST');
req1.setEndpoint(ts.URL__c+URL);//URL will be your Salesforce REST API end point where you will do POST,PUT,DELETE orGET
HttpResponse res1 = h1.send(req1);
system.debug('RESPONSE_BODY'+res1 .getbody());To deserialize the initial response here is wrapper class the above code uses-
/*To get aouthentication detail Wrapper*/
public class OAuth2{
public String id{get;set;}
public String issued_at{get;set;}
public String instance_url{get;set;}
public String signature{get;set;}
public String access_token{get;set;}
}
Hope this helps. -
shariq
MemberSeptember 15, 2018 at 6:24 pm in reply to: How do I include external JavaScript libraries in Salesforce lightning components?Hi,
Try this -
<ltng:require scripts="{!$Resource.resourceName}"
afterScriptsLoaded="{!c.afterScriptsLoaded}" />Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 6:22 pm in reply to: What is WSDL and how can we trim WSDL in salesforceHi,
Salesforce provides a WSDL (Web Service Description Language) files. They are called "Enterprise WSDL" and "Partner WSDL". A WSDL is an XML-document which contains a standardized description on how to communicate using a web service (the Salesforce API is exposed as a web service).
The usual method is manual editing, although it should be possible to use the Eclipse IDE's WSDL editing mode to trim out the extra functions that you don't need. You will still need to take care not to delete dependencies that are actually required, because Eclipse cannot validate what is or isn't necessary directly.
User who is generating enterprise WSDL in your case has access to all the managed packages you are seeing in the wsdl. You should perform the export as the user that has the correct permissions.
Hope it helps.
-
shariq
MemberSeptember 15, 2018 at 6:19 pm in reply to: Can I integrate Salesforce lightning components with another framework?Hi,
To add more -
The Lightning Component Framework is a great UI framework for building modern components and applications on the Salesforce platform. If you are already invested in other UI frameworks, like React or Angular, you can also integrate components built with these frameworks inside Lightning Components.
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 6:17 pm in reply to: What are the limitations of the WSDL file in Salesforce?Hi,
Mapping Headers
Headers defined in the WSDL document become public fields on the stub in the generated class. This is similar to how the AJAX Toolkit and .NET works.
Understanding Runtime Events
The following checks are performed when Apex code is making a callout to an external service.- For information on the timeout limits when making an HTTP request or a Web services call, see Callout Limits and Limitations.
- Circular references in Apex classes are not allowed.
- More than one loopback connection to Salesforce domains is not allowed.
- To allow an endpoint to be accessed, register it from Setup by entering Remote Site Settings in the Quick Find box, then selecting Remote Site Settings.
- To prevent database connections from being held up, no transactions can be open.
Understanding Unsupported Characters in Variable Names
A WSDL file can include an element name that is not allowed in an Apex variable name. The following rules apply when generating Apex variable names from a WSDL file:- If the first character of an element name is not alphabetic, an x character is prepended to the generated Apex variable name.
- If the last character of an element name is not allowed in an Apex variable name, an x character is appended to the generated Apex variable name.
- If an element name contains a character that is not allowed in an Apex variable name, the character is replaced with an underscore (_) character.
- If an element name contains two characters in a row that are not allowed in an Apex variable name, the first character is replaced with an underscore (_) character and the second one is replaced with an x character. This avoids generating a variable name with two successive underscores, which is not allowed in Apex.
- Suppose you have an operation that takes two parameters, a_ and a_x. The generated Apex has two variables, both named a_x. The class doesn’t compile. Manually edit the Apex and change one of the variable names.
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 6:13 pm in reply to: Can we make a Salesforce Lightning Component that shows up in both the mobile and the desktop user interfaces?Hi,
Lightning components were designed with Lightning Experience in mind. As the core Salesforce app shifts to the app-centric framework, we want you to shift along with us. We want you to think about developing on the platform in a whole new way.
You might have developed some Lightning components in Salesforce Classic. You can still use the old interface with Lightning components and all your existing component functionality transfers seamlessly into Lightning Experience.
So you can use Salesforce Lightning Component for both mobile and the desktop user interfaces.
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 6:10 pm in reply to: Can we make one component inherit styles/CSS from a parent component in Salesforce?Hi,
For make it more clear -
A sub component that extends a super component inherits the attributes of the super.
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 6:03 pm in reply to: Is there any limit on the number of lightning components in one Salesforce application?Hi,
There is no limit for components but there is a limit for code storage in your salesforce org.
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 5:59 pm in reply to: What are the different Salesforce Lightning component bundles?Hi,
Component or Application
sample.cmp or sample.app
The only required resource in a bundle. Contains markup for the component or app. Each bundle contains only one component or app resource.
CSS Styles
sample.css
Contains styles for the component.
Controller
sampleController.js
Contains client-side controller methods to handle events in the component.
Design
sample.design
File required for components used in Lightning App Builder, Lightning pages, Community Builder, or Cloud Flow Designer.
Documentation
sample.auradoc
A description, sample code, and one or multiple references to example components
Renderer
sampleRenderer.js
Client-side renderer to override default rendering for a component.
Helper
sampleHelper.js
JavaScript functions that can be called from any JavaScript code in a component’s bundle
SVG File
sample.svg
Custom icon resource for components used in the Lightning App Builder or Community Builder.Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 5:48 pm in reply to: How Salesforce lightning component is better than visualforce page?Hi,
The Visualforce framework provides a robust set of tags that are resolved at the server-side and that work alongside standard or custom controllers to make database and other operations simple to implement. This is a page-centric web application model. It’s great for basic functionality, but it’s challenging to deliver the new, more dynamic experience that users expect. Fundamentally, this is because it relies on the server to generate a new page every time you interact with the application.
Lightning components are part of the new Salesforce user interface framework for developing dynamic web applications for desktop and mobile devices. They use JavaScript at the client-side and Apex at the server-side to provide the data and business logic. To deliver a more interactive experience, you need help from JavaScript on the client-side. In this new app-centric model, JavaScript is used to create, modify, transform, and animate the user interface rather than completely replacing it a page at a time. This model is exciting, interactive, and fluid.
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 5:36 pm in reply to: When a BatchApexworker record is created in batch apex in salesforce?Hi,
To add more -
BatchApexworker used internally by Salesforce. For each 'AsyncApexJob' record of type 'BatchApex', Apex creates for internal use an 'AsyncApexJob' record of type 'BatchApexWorker' per 10,000 records to be processed. When querying for all 'AsyncApexJob' records, we recommend that you filter out records of type 'BatchApexWorker' using the 'JobType' field to avoid returning more than one record for each 'AsyncApexJob' record of type 'BatchApex.'
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 5:34 pm in reply to: What is AsyncApexJob object in batch apex in Salesforce?Hi,
In Salesforce, records in the 'AsyncApexJob' table represents Apex jobs to run asynchronously when resources are available. Examples of these asynchronous Apex jobs include Future Methods, Queueable Apex, Batch Apex and Scheduled Apex. If we examine the SOAP API guide for the 'AsyncApexJob' object, we see these mentioned asynchronous jobs represented under the 'JobType' field, however we also observe a number of other job types such as 'ApexToken', 'TestWorker' and 'TestRequest'.
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 5:31 pm in reply to: How to implement callout integration in Salesforce?Hi,
Just to add a Note -
Before any Apex callout can call an external site, that site must be registered in the Remote Site Settings page, or the callout fails. Salesforce prevents calls to unauthorized network addresses.
If the callout specifies a named credential as the endpoint, you don’t need to configure remote site settings. A named credential specifies the URL of a callout endpoint and its required authentication parameters in one definition. To set up named credentials, see “Define a Named Credential” in the Salesforce Help.
Hope this helps.
-
shariq
MemberSeptember 15, 2018 at 5:29 pm in reply to: What are the advantages of statelessness in RESTful Webservices in Salesforce?Hi,
REST APIs are stateless, meaning that calls can be made independently of one another, and each call contains all of the data necessary to complete itself successfully.
Hope this helps.