Forum Replies Created

Page 4 of 6
  • Hi vikas,

    You can try the following code for this:

    @RestResource(urlMapping='/wrapper/*')
    global with sharing class campclass{
    @HttpGet
    global static List<Accountwrapper> doget() {

    RestRequest req = RestContext.request;
    String accphone = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
    RestResponse res = RestContext.response;

    List<Account> result = [Select Id, name,phone from account where phone=:accphone];
    System.debug('Result:::'+result);

    List<Accountwrapper> accWrapList = new List<Accountwrapper>();
    for(Account acc : result){
    Accountwrapper accWrap = new Accountwrapper();
    accWrap.accId = acc.Id;
    accWrap.Name = acc.Name;
    accWrap.Phone = acc.Phone;
    accWrapList .add(accWrap);
    }
    return accWrapList ;
    }
    global class Accountwrapper {
    Public Id accId;
    public String Name;
    public String Phone;

    }
    }

    Thanks

  • sushant

    Member
    January 17, 2017 at 2:47 pm in reply to: Formula Field for current time in Salesforce

    Hi Kumar,

    Follow this link,it may help you:

    https://help.salesforce.com/articleView?id=000005091&language=en_US&type=1

    Thanks

  • sushant

    Member
    January 17, 2017 at 2:46 pm in reply to: Marketing cloud integration with salesforce

    Hi Kumar,

    Follow this link,hope it helps you:

    https://segment.com/docs/integrations/salesforce-marketing-cloud/

    Thanks

  • sushant

    Member
    January 17, 2017 at 2:44 pm in reply to: How to create dashboard of a Joint type report in Salesforce?

    Hi Kumar,

    follow this link,it may help you

    https://success.salesforce.com/answers?id=90630000000ghXBAAY

    Thanks

  • Hi Kumar,

    You can do this like as follows:

    List<Account> accounts = [
    SELECT
    Id
    FROM
    Account
    ];

    Set<Id> accountIds = new Set<Id>();
    for(Account acc:accounts){
    accountIds.add(acc.Id);
    }

    Thanks

  • sushant

    Member
    January 16, 2017 at 2:35 pm in reply to: What are the uses of Lightning Schema in Salesforce?

    Thanks

  • sushant

    Member
    January 16, 2017 at 2:31 pm in reply to: what are Rest Resources in salesforce?

    Hi Vikas,

    A REST resource is an abstraction of a piece of information or an action, such as a single data record, a collection of records, or a query. Each resource in REST API is identified by a named Uniform Resource Identifier (URI) and is accessed using standard HTTP methods (HEAD, GET, POST, PATCH, DELETE). REST API is based on the usage of resources, their URIs, and the links between them.

    For more info follow this link:

    https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_rest_resources.htm

    Thanks

  • sushant

    Member
    January 16, 2017 at 2:29 pm in reply to: Fetch Account Records Using Rest Api in Salesforce

    Hi Vikas,

    The following example may help you:

    global class TestRESTAPI{

    global void authenticateAPI(){

    httprequest req = new httprequest();
    http testHttp = new http();

    req.setMethod('GET');
    req.setEndPoint('https://login.salesforce.com/services/oauth2/token');
    req.setBody('grant_type=password&client_id=3MVG9ZL0ppGP5UrBUp_MAQLjBuF1yI1xECRabWZ8No_gyZ4WF3HVrSDyMTTxN13GWhhhrH2Sqg84AsVR3Y0ib&client_secret=9013832611733751894&[email protected]&password=Test@1234');
    HttpResponse res = testHttp.send(req);
    System.debug(res.getBody());
    }

    global void getAccounts(){

    httprequest req = new httprequest();
    http testHttp = new http();

    req.setMethod('GET');
    req.setEndPoint('https://ap2.salesforce.com/services/data/v38.0/sobjects/Contact');
    req.setHeader('Authorization','OAuth 00D28000001yTWP!AQwAQMPFnsn66o3QnIG.vRfAwkPm1bBVumQlEB4rK.ywUQFzlfx6bvhLIH5XH18ilDT7CxD9o5Bu_kql4fN4r0J06Wj7N7rv');
    HttpResponse res = testHttp.send(req);
    System.debug(res.getBody());
    }
    global void postvalue(){
    httprequest req=new httprequest();
    http testHttp=new http();
    req.setMethod('POST');
    req.setEndPoint('https://ap2.salesforce.com/services/data/v38.0/sobjects/Account');
    req.setHeader('Authorization','OAuth 00D28000001yTWP!AQwAQD0UJZIVUyvnBXkNck7RN9TOqY0swbTwAlL2xjefUKrHqBqwN43yxnT26ghfUzGu82Zmy.oBKW2tn.UoheV9A7A9dZeu');
    req.setHeader('Content-Type', 'application/json');
    req.setBody('{"name" : "FromSushant"}');
    HttpResponse res=testHttp.send(req);
    System.debug(res.getBody());
    }
    }

    Thanks

  • sushant

    Member
    January 16, 2017 at 2:27 pm in reply to: Converting Salesforce sobject List into string List

    Hi Vikas,

    This example can help you:

    public class GetRestfulExampleSu{

    public string jsonStr {get;set;}
    public Pagereference getJSONFromREST() {
    Http h = new Http();
    HttpRequest req = new HttpRequest();
    req.setEndpoint('http://dz.co.rplug.renault.com/localsemiclair/BAWn');
    req.setHeader('Accept','application/JSON');
    req.setMethod('GET');
    HttpResponse res = h.send(req);
    jsonStr= res.getBody();

    system.debug('jsonStr>>>>-->>>>>>'+jsonStr);

    jsonStr= res.getBody();

    Map<String,Object> rawObj = (Map<String,Object>) JSON.deserializeUntyped(jsonStr);

    Map<String,Object> responseObj = (Map<String,Object>)rawObj.get('localSemiClair');
    Map<String,Object> responseObjinside2 = (Map<String,Object>)responseObj.get('mapRepresentation');
    Map<String,Object> responseObjinside3 = (Map<String,Object>)responseObjinside2 .get('map');

    List<Object> reqs = (List<Object>) responseObjinside3.values();
    List<string> lsstr= new List<string> ();

    for(Object a: reqs){
    lsstr.add(String.valueOf(a));
    }

    return null;
    }

    }

    Thanks

  • sushant

    Member
    January 16, 2017 at 2:24 pm in reply to: Conversion of JSON Format attributes to Salesforce Sobjects

    Hi Vikas,

    The format for conversion is as follows:

    public class JSON2Apex {

    public class Attributes {
    public String type;
    public String url;
    }

    public class Books {
    public Attributes attributes;
    public String Name;
    public String Id;
    public String Author__c;
    }

    public List<Books> Books;
    public static JSON2Apex parse(String json) {
    return (JSON2Apex) System.JSON.deserialize(json, JSON2Apex.class);
    }

    static testMethod void testParse() {
    String json = '{ \"Books\" : [ { \"attributes\" : { \"type\" : \"Book__c\", \"url\" : \"/services/data/v30.0/sobjects/Book__c/a019000000CFwyNAAT\" }, \"Name\" : \"C fundamental\", \"Id\" : \"a019000000CFwyNAAT\", \"Author__c\" : \"Bharat\" },'+
    '{ \"attributes\" : { \"type\" : \"Book__c\", \"url\" : \"/services/data/v30.0/sobjects/Book__c/a019000000CFwycAAD\" }, \"Name\" : \"Network Security\", \"Id\" : \"a019000000CFwycAAD\", \"Author__c\" : \"Vikram\" },'+
    '{ \"attributes\" : { \"type\" : \"Book__c\", \"url\" : \"/services/data/v30.0/sobjects/Book__c/a019000000CFwyIAAT\" }, \"Name\" : \"Core Java\", \"Id\" : \"a019000000CFwyIAAT\", \"Author__c\" : \"Rohit\" },'+
    '{ \"attributes\" : { \"type\" : \"Book__c\", \"url\" : \"/services/data/v30.0/sobjects/Book__c/a019000000CFwy3AAD\" }, \"Name\" : \"salesforce\", \"Id\" : \"a019000000CFwy3AAD\", \"Author__c\" : \"Amit\" },'+
    '{ \"attributes\" : { \"type\" : \"Book__c\", \"url\" : \"/services/data/v30.0/sobjects/Book__c/a019000000CG020AAD\" }, \"Name\" : \"SFDC admin\", \"Id\" : \"a019000000CG020AAD\", \"Author__c\" : \"Om\" } ] }';
    JSON2Apex obj = parse(json);
    System.assert(obj != null);
    }
    }

    Hope this helps you

  • sushant

    Member
    January 13, 2017 at 2:53 pm in reply to: How can we implement callouts using future methods in salesforce?

    Hi Vikas,

    The following is a skeletal example of a future method that makes a callout to an external service. Notice that the annotation takes an extra parameter (callout=true) to indicate that callouts are allowed.

    global class FutureMethodExample
    {
    @future(callout=true)
    public static void getStockQuotes(String acctName)
    {
    // Perform a callout to an external service
    }

    }

    Thanks

  • sushant

    Member
    January 13, 2017 at 2:50 pm in reply to: What are the advantages of Salesforce Lightning over classic view?
  • sushant

    Member
    January 13, 2017 at 2:47 pm in reply to: How to use Soql Wildcards in salesforce?

    Hi Vikas,

    You can use wildcards like this:

    1  select id, firstname, lastname  from lead where lastname like 'Smith%'

     

    Will match all last names starting with Smith.

     

    2  select id, firstname, lastname  from lead where lastname like 'Smith_'

     

    Will match all last names starting with Smith up to 1 additional character

     

     

    3  Like 'appl_%'

    matches Appleton, Apple, and Bappl , but not Appl

     

    4 Contact.Account.Name LIKE '%Apple%' , '%Pear%'

    Accounts that contain "Apple" and "Pear".

    Thanks

  • Hi Vikas,

    You can use Schema class for this.

    Schema.SObjectType sobjectType = myId.getSObjectType();
    String sobjectName = sobjectType.getDescribe().getName();

    Thanks

  • Hi

    To access sharing programmatically, you must use the share object associated with the standard or custom object for which you want to share. For example, AccountShare is the sharing object for the Account object, ContactShare is the sharing object for the Contact object, and so on. In addition, all custom object sharing objects are named as follows, where MyCustomObject is the name of the custom object:

    MyCustomObject__Share

    Objects on the detail side of a master-detail relationship do not have an associated sharing object. The detail record’s access is determined by the master’s sharing object and the relationship’s sharing setting. For more information, see “Custom Object Security” in the Salesforce online help.

    A share object includes records supporting all three types of sharing: Force.com managed sharing, user managed sharing, and Apex managed sharing. Sharing granted to users implicitly through organization-wide defaults, the role hierarchy, and permissions such as the “View All” and “Modify All” permissions for the given object, “View All Data,” and “Modify All Data” are not tracked with this object.

    Thanks

  • sushant

    Member
    January 12, 2017 at 2:36 pm in reply to: What is the Data Storage Soft limit in Salesforce?

    Hi

    For data storage, Contact Manager, Group, Professional, Enterprise, Performance, and Unlimited Editions are allocated the greater of 1 GB or a per-user limit. For example, a Professional Edition org with 10 users receives 1 GB, because 10 users multiplied by 20 MB per user is 200 MB, which is less than the 1 GB minimum. A Professional Edition org with 100 users receives more than the 1 GB minimum, because 100 users multiplied by 20 MB per user is 2,000 MB.

    Thanks

  • sushant

    Member
    January 12, 2017 at 2:34 pm in reply to: Files vs Attachments in Salesforce

    Hi Kumar,

    Files refer to salesforce content management system.you can create libraries for files and manage their access. Files tab is the place for these.Refer link below:

    [https://help.salesforce.com/apex/HTViewHelpDoc?id=collab_files_overview.htm&language=en]

    Notes & Attachments are something specific to each record. you can control wether attachments are allowed on an object or not by a check box on object settings.Access to each record controls access to its attachments.

    [https://help.salesforce.com/apex/HTViewHelpDoc?id=notes_fields.htm]

    Thanks

  • sushant

    Member
    January 12, 2017 at 2:33 pm in reply to: Custom Tab not showing in Salesforce Lightning navigation menu

    Hi Kumar,

    If the tab is set to Tab Off on any of the profiles that use the navigation menu, then the tab will not show up for any of them. It doesn't make logical sense, but I've tested it and sure enough. After changing each of the profiles included in the navigation menu to have the Tab On permission for the tab that wasn't showing up, the tab now appears.

    Thanks

  • sushant

    Member
    January 11, 2017 at 2:25 pm in reply to: How can we specify the action on URLFOR in apex in salesforce?

    Hi Mohit,

    The $Action global variable allows you to dynamically reference valid actions on an object type, or on a specific record. The most likely way to make use of this is to create a URL to perform that action.
    For example, you can use the expression {!URLFOR($Action[objectName].New)} in an <apex:outputLink>, with a controller method getObjectName() that provides the name of the sObject.

    Follow this link for more info:

    https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_dynamic_vf_globals_action.htm

    Thanks

  • sushant

    Member
    January 11, 2017 at 2:23 pm in reply to: Webhook vs rest Api in Salesforce

    Hi Vikas,

    The API is an interface to your data on example.com. The API is used from your server to the example.com platform and can be used to List, Create, Edit or Delete items.

    Webhooks are automated calls from example.com to your server triggered when a specific event happens in example.com. For example, when a task is completed and you want to know about it in real time we'll make a POST request to the URL you have registered for the EVENT.COMPLETED webhook in your example account.

    So, in a nutshell: The API is where you tell example.com things and Webhooks is where example.com tell you things.

    Hope this helps you

    Thanks

  • sushant

    Member
    January 11, 2017 at 2:18 pm in reply to: What can be the Use of Salesforce flows?

    Hi Vikas,

    Salesforce Admins and Developers have a myriad of tools at their disposal—from APIs and Apex code, to workflow rules and page layouts. But with Flow, that toolbox just got exponentially bigger. With Flow, we open up the power of the platform to the declarative developer, and the best part about Flow is that it doesn’t require you knowing any code

    Follow this link for more info:

    https://www.salesforce.com/blog/2014/07/top-5-things-to-do-with-flow.html

    Thanks

  • Hi Vikas,

    Workflow:

    Workflow enables you to set up workflow rules. A workflow rule identifies what kinds of record changes or additions trigger specified workflow actions, such as sending email alerts and updating record fields.

    Workflow rules and actions are associated with a specific object (and can cross objects only to update fields on a related master record).

    Visual Workflow:

    Visual Workflow enables you to create flows, which are triggered by users rather than events. Unlike Workflow, which always executes rules and actions behind the scenes, Visual Workflow offers screens for displaying and collecting information from the user running the flow.

    Flows aren’t tied to any one object. They can look up, create, update, and delete records for multiple objects.

    Process Builder:

    The Process Builder’s simple and powerful design allows you to:Create your processes using a convenient layout with point-and-click efficiency.
    Create your whole process in one place rather than using multiple workflow rules.
    Create processes by collaborating with different teams in your business.
    Stop using Apex code to automate simple tasks.

    Hope this helps you

    Thanks

  • sushant

    Member
    January 10, 2017 at 1:57 pm in reply to: Conversion of String to DateTime format in Salesforce Org

    Hi Kumar,

    Looks like DateTime.parse() takes the string and parses it based on the context users locale to produce a GMT date/time in the database. DateTime.format(String) should create an output string in based on the timezone of the current context user.

    So you should be able to use when data comes in:

    DateTime dt = DateTime.parse('11/6/2014 12:00 AM');
    Then when you go to call the web service you'd use something like:

    String dtOut = dt.format('d/M/y'); -- Or M/d/y if you're using American dates.
    And for the bonus, you could just use a different argument in the format function such as:

    String timOut = dt.format('h:m a');

    Hope this helps you

    Thanks

  • Hi Kumar,

    paid apps in ISVForce pay 15% revenue to Salesforce. In return the primary benefits that you get are:

    Two (2) Enterprise Licenses for Salesforce to use for your company
    Use of the Salesforce License Management App (LMA). The LMA gives you a way to manage licensing of your app for your customers
    The opportunity to participate in paid advertising on the AppExchange
    In addition two these two partner models, you can choose to use AppExchange Checkout.

    If you choose to be an AppExchange Checkout partner, you will still pay a 15% revenue share plus a small per transaction fee. You will get the first two benefits above (2 licenses and use of the LMA). You will also get the ability to use AppExchange Checkout to automatically charge your customers credit cards for payment. This is a great option for low cost apps that are simple for customers to set-up on their own.

    Thanks

  • sushant

    Member
    January 10, 2017 at 1:49 pm in reply to: Client Side search in Salesforce Visualforce page using Javascript

    Hi Kumar,

    In this scenario,You can use query in javascript to obtain your desired output.

    Follow this link,hope this helps you.

    https://developer.salesforce.com/forums/?id=906F0000000BPbaIAG

    Thanks

Page 4 of 6