Forum Replies Created

Page 2 of 3
  • Ajay Prakash

    Member
    February 11, 2018 at 4:46 pm in reply to: How to open popup in Lightning Component?

    You can create modal provided by Salesforce

    <div class="demo-only" style="height: 640px;">
    <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
    <div class="slds-modal__container">
    <header class="slds-modal__header">
    <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close">
    <svg class="slds-button__icon slds-button__icon_large" aria-hidden="true">
    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#close" />
    </svg>
    <span class="slds-assistive-text">Close</span>
    </button>
    <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">Modal Header</h2>
    </header>
    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
    </div>
    <footer class="slds-modal__footer">
    <button class="slds-button slds-button_neutral">Cancel</button>
    <button class="slds-button slds-button_brand">Save</button>
    </footer>
    </div>
    </section>
    <div class="slds-backdrop slds-backdrop_open"></div>
    </div>

    Show and hide this model from button action.

     

  • Ajay Prakash

    Member
    February 11, 2018 at 4:24 pm in reply to: How to assign permission set to a public group?

    Hi Hazel,

    You can not assign a permission set to a public group directly. This is still an idea "Permission Sets For Pubic Groups".that salesforce has not released. You can assign the permission set to users as described by Abhinav or Ajit.

    Hope this helps.

     

    • This reply was modified 6 years, 9 months ago by  Ajay Prakash.
  • Ajay Prakash

    Member
    February 11, 2018 at 3:54 pm in reply to: Do we have some step-by-step guide to create Lightning Components?

    You can follow below steps-

    In your DE org, open the Developer Console under Your Name or the quick access menu (Setup gear icon).

    Light1

    Now Select File | New | Lightning Component to create a new Lightning component. In the New Lightning Bundle panel, enter "HelloWorld" for the component name, and click Submit.

    It will look like -

    Light2

    If you want to explore more about lightning component then go to the trailhead.

     

     

  • Ajay Prakash

    Member
    February 11, 2018 at 3:23 pm in reply to: How to fetch list view columns without using MetaData Api Call?

    Hi Neha,

    You can retrieve the records based on the list view id using HTTP request. It can be done without consuming WSDL. You can use below code for reference -

    public static List<Account> getFilteredAccounts(String filterId){
    HttpRequest req = new HttpRequest();
    String baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
    String endPoinURL = baseUrl+'/services/data/v32.0/sobjects/Account/listviews/'+filterId+'/describe';
    req.setEndpoint(endPoinURL);
    req.setMethod('GET');
    req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId());
    Http http = new Http();
    HTTPResponse response = http.send(req);
    Map<String, Object> tokenResponse = (Map<String, Object>)                 JSON.deserializeUntyped(response.getBody());
    String query = (String) tokenResponse.get('query');
    List<Account> AccountList = new List<Account>();
    for(Account accountObj : database.query(query)){
    AccountList.add(accountObj);
    }
    return AccountList;

    }

    In the above example, I have retrieved accounts based on the selected list view. Any other profile which is API enabled and has read access on the Account object can retrieve the records.

  • Hi Nauman,

    Salesforce has released Lightning Data Services in Summer ’17 release. Using Lightning Data Services you can perform CRUD operation without using any APEX code. Lightning Data Services is very similar to the Standard controller of Salesforce Classic.

    If you want to use this, go through the Trailhead for basics.

    Hope this helps you.

     

  • Hi Saurabh,

    If the workflow action has multiple field updates then The field updates occur "simultaneously" it does not follow any order. However, if we talk about other actions -

    1. Email Alerts
    2. Tasks
    3. Field Updates
    4. Outbound Messages

    Field update actions are executed first among the above actions. The order for rest of the other action is not guaranteed.

    Hope this helps!

     

     

     

     

  • Hi Ankit,

    These both are the access modifiers of apex class, methods, variables. Public means the method or variable can be used by any Apex in this same application or in the same namespace. Global provides a hieger level of access than Public.Any global method or variable can be accessed by any apex code that has access to the class not only from the same application but from outside the application. Global is not recommended, so use only when you need to give access to outside the application.

  • Ajay Prakash

    Member
    January 15, 2018 at 6:59 am in reply to: How can we insert multiple sObjects in a single DML operation?

    Hi Subhendu,

    Yes, you can insert multiple sObjects in single DML Operation. Refer below code -

    list<sobject> sObjList = new list<sObject>();
    Account acc = new Account(name='testAcc');
    Contact con = new Contact(lastName ='TestCon');
    sObjList.add(acc);
    sObjList.add(con);
    insert sObjList;

    You can not insert parent and child record both in single DML statement. Ex. In the above sample code, you can not associate a contact with the account being inserted in the same transaction.

     

  • Ajay Prakash

    Member
    January 13, 2018 at 3:16 pm in reply to: Is it possible to run a SOQL Query and get a MAP returned?

    Hi Tanu,

    Yes, You can run SOQL query and return into a map. You can refer below code it will return a map of Account id vs Account map-

    Map<id,Account> mapOfAccountIdVsAccount = new Map<Id,Account>([SELECT Id, Name FROM Account]);
    system.debug('mapOfAccountIdVsAccount::'+mapOfAccountIdVsAccount);

    Thanks.

     

  • Hi Shariq,

    You can not insert Account and its related contacts in the single transaction. You need to insert account first and then its related contacts. To insert related contacts you need the id of the parent Account.

    Please let us know what you have tried so far, in your scenario then we may be more helpful.

    Thanks.

     

    • This reply was modified 6 years, 10 months ago by  Ajay Prakash.
  • Ajay Prakash

    Member
    January 13, 2018 at 2:52 pm in reply to: What to do in case you are getting "ApiLog msg" error?

    Hi Rahul,

    I don't understand how it was working fine. I think there must be some change in your scenario. You cannot perform a DML operation prior to a callout. All the DML operations should be invoked only after you are done with callouts.So, make a web service callout first and then save the request.

    Thanks.

     

  • Hi Rahul,

    You can not create a custom field on case comment object currently. This feature is still on the idea "Add Custom Field to Case Comment". However, some alternatives could include building a custom Case Comments object.You can copy the data into standard case comment object using workflow, trigger as suggested in the idea's comment.

     

    Thanks.

  • Ajay Prakash

    Member
    January 10, 2018 at 3:10 pm in reply to: Get Error information without UI in Salesforce

    Hi Abhishek,

    To see the error occurred in the catch block there can be two option-

    1. You can create a Outbound Email service in the catch block and send the error message in the email.
    2. You can create a custom object (Ex. Error Log) with text area fields and create a record from the catch block in this object. In this way you can read the error message from the created record.

    Thanks.

  • Hi Suraj,

    Aura is an open-source UI framework built by Salesforce for developing dynamic web apps for mobile and desktop devices.To build lightning components in salesforce lightning we use the Lightning component framework. The lightning component framework is not different from the Aura framework rather it is a subset of the Aura framework.  The Lightning Component framework is built on the open-source Aura framework. However, the open-source Aura framework has some features that aren't available to Lightning Component framework.

    Thanks.

     

  • Hi subramanyam,

    Use below code, it will provide you a map of Account vs list of associated contacts.

    map<Account,list<Contact>> mapOfAccountVsContact = new map<Account,list<Contact>>();
    for(Account accObj : [select id, name, (select id,lastname from contacts) from Account]){
    mapOfAccountVsContact.put(accObj,accObj.Contacts);
    }
    system.debug('mapOfAccountVsContact::'+mapOfAccountVsContact);

  • Master-Detail Relationship :

    1. It creates the parent(master) child(Detail) relationship between objects.
    2. If we delete master records then detail (Child) records are deleted.
    3. Rollup-summary field can be created in a master-detail relationship.
    4. We can have maximum 2 master details on an object
    5. Master is required field on the child object.

    Look up Relationship :

    1. Look up relationship creates relations between two objects.
    2. If we delete any object then another object is not deleted.
    3. We can have maximum 25 lookups on an object.
    4. Parent is not required in the child record.
    5. Rollup-summary field can be created in this relationship.

    To convert master-detail to lookup and vice versa -

    You can convert a master-detail relationship to a lookup relationship as long as no roll-up summary fields exist on the master object.

    You can convert a lookup relationship to a master-detail relationship, but only if the lookup field in all records contains a value.

    • This reply was modified 6 years, 10 months ago by  Ajay Prakash.
  • Ajay Prakash

    Member
    January 6, 2018 at 9:36 am in reply to: What is enqueue action and app hostile in Salesforce?

    Hi Sandeep,

    I am considering you are asking to enqueue in reference to the lightning component. Whenever you want to call a server side method from a javascript controller you need to create an action. enqueue action is the keyword that binds server-side action with the Aura framework.

    Thanks.

  • If the junction object has two parents (Master-Detail), then the Junction Object can’t be on the master side of another master-detail relationship because You can't create a master-detail on an object with two master-detail. It's a limitation of the system. However, not all junction objects have two master-detail relationships, so it is indeed possible to create a master-detail relationship where the master is the junction object.

  • Hi Abhay,

    While it is possible to use an iframe in the visualforce page and lightning component, Salesforce strongly recommends avoiding this. Visualforce pages are wrapped in their own iframe when displayed in Lightning Experience. If you use an iframe in the visualforce page it will add an additional level to the iframe that increases the complexity of the environment.Also, it will be difficult to debug an issue. If we talk about merits then I will say you don't need to write additional code to remove the iframe for the existing functionality. If you want more detail then go through the document  .

    Thanks.

  • Ajay Prakash

    Member
    January 4, 2018 at 7:03 am in reply to: Click on button redirect to another page in Salesforce.

    Hi Up,

    If you are calling controller method from lightning component then you can not return Pagereference from that controller method because AuraEnabled methods do not support return type of System.PageReference.

    Workaround-

    You can open any link from your callback of javascript controller

    action.setCallback(this,function(response){
    if((response.getState()=="SUCCESS")&&(component.isValid())){
    if(response.getReturnValue() != null){
    window.location.href = 'your link';
    } }
    });

  • Hi Radhakrishna,

    I believe workflow rule, trigger or Process builder will not fire on chan in the value of formula field. Formula field values are not stored in the database, what happens if you retrieve the record is formula value is calculated dynamically and displayed.

    Let me know if this helps you.

    Thanks.

     

  • Hi Martina,

    It will be a two-step process. First, you need to fetch all contact ids which has more than one contact.In the second step, you can retrieve Account information.

    set<Id> setOfContactIds = new set<id>();
    for(Contact conObj : [select id, (select id from AccountContactRelations where isDirect = false) from contact]){
    if(conObj.AccountContactRelations.size()>0){
    setOfContactIds.add(conObj.id);
    }
    }
    system.debug('::'+[select id, Account.name from AccountContactRelation where ContactId IN:setOfContactIds]);

  • Hi Raghav,

    This is a very generic question. You can get a lot of content on Google. It will be better if you provide some content in your question what you have tried so far?

    Thanks.

  • Ajay Prakash

    Member
    January 4, 2018 at 3:58 am in reply to: How to create a custom field on a standard Salesforce object?

    Hi Pramod,

    Although your question is not clear, I guess you want to create the custom field on a standard object using apex from the user interface i.e. Visualforce.

    To do so you need to consume metadata API in your Salesforce Org.For more details about metadata, API follows the link  Understanding Metadata API. Once your metadata apex class is created you need to call below method from you visualforce page while passing the certain parameters that you want to take input from the user.Ex- Object Name, Field Name, Field Type, Field Size, etc.

    public static void createField(){
    MetadataService.MetadataPort service = createService();
    MetadataService.CustomField customField = new MetadataService.CustomField();
    customField.fullName = 'Test_Object__c.Test_Custom_Field__c';
    customField.label = 'Test Custom Field';
    customField.type_x = 'Text';
    customField.length = 22;
    List<MetadataService.SaveResult> results =
    service.createMetadata(
    new MetadataService.Metadata[] { customField });
    handleSaveResults(results[0]);
    }

    In the above method, I have passed the static values that you have to replace from the User inputs.In the whole process, you will require creating a remote site setting because to create a metadata above code will make a callout in the same org where you want to create the custom field.

    Let me know if this helps you.

    Thanks.

     

    • This reply was modified 6 years, 10 months ago by  Ajay Prakash.
  • Hi Shariq,

    Yes, you can call Handler method from multiple method of controller. Since Helper is shared across controller and Renderers you can call any method of helper from controller or renderer.

    Let me know if you still have any doubt.

    Thanks.

     

Page 2 of 3