Forum Replies Created

Page 8 of 8
  • Surbhi

    Member
    May 25, 2016 at 1:17 pm in reply to: Get all Parent and child objects related to the current object

    Hi Himanshu,

    For getting All Parent objects:

    for(Schema.SobjectField strFld: Account.SobjectType.getDescribe().fields.getMap().Values()){
    if(strFld.getDescribe().getType() == Schema.DisplayType.REFERENCE){
    system.debug('==parent object='+strFld.getDescribe().getReferenceTo());
    }
    }

    For getting All Child objects:

    Schema.DescribeSObjectResult R = Account.SObjectType.getDescribe();
    for (Schema.ChildRelationship cr: R.getChildRelationships()) {
    system.debug('====child object==='+cr.getChildSObject());
    }

    *Change Account as per your requirement.

    Thanks

  • Surbhi

    Member
    May 25, 2016 at 12:51 pm in reply to: How to chatter post through Apex??

    Hi Himanshu,

    Please find the below code for chatter post through apex:

    //Adding a Text post
    FeedItem post = new FeedItem();
    post.ParentId = oId; //eg. Opportunity id, custom object id..
    post.Body = 'Enter post text here';
    insert post;

    //Adding a Link post
    FeedItem post = new FeedItem();
    post.ParentId = oId; // Record Id eg. Opportunity id, custom object id..
    post.Body = 'Enter post text here';
    post.LinkUrl = 'http://www.infallibletechie.com';
    insert post;

    //Adding a Content post
    FeedItem post = new FeedItem();
    post.ParentId = oId; // Record Id eg. Opportunity id, custom object id..
    post.Body = 'Enter post text here';
    post.ContentData = base64EncodedFileData;
    post.ContentFileName = 'infallible.pdf';
    insert post;

    Hope this will help you.

    Thanks

  • Surbhi

    Member
    May 25, 2016 at 6:03 am in reply to: How to unarchive activities?

    Hi Piyush,

    Use "queryAll" in the API to retrieve the activities. The Data Loader exposes queryAll as "Export All." Then you have to perform an update to the records. You only need to call update() using records by Id. Archived activities will be restored upon saving.

    Thanks

     

  • Surbhi

    Member
    May 25, 2016 at 5:56 am in reply to: How to package event types in a Lightning component bundle?

    Hi Piyush,

    Lightning events should be put into their own directory, separate from the components.

    Thanks

  • Hi Ravi,

    This doesn't support "EmailTemplate". You have to individually name each template. You can also refer to below link:

    http://www.salesforce.com/us/developer/docs/daas/Content/daas_package.htm

    Thanks

  • Surbhi

    Member
    May 25, 2016 at 5:36 am in reply to: How do you access chatter public links through apex/api?

    Hi Ravi,

    I guess you are talking about chatter file public links. So, for that you can refer to below link:

    https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdistribution.htm

    Thanks

  • Surbhi

    Member
    May 25, 2016 at 5:20 am in reply to: Can a variable be passed to an apex:repeat in Salesforce?

    Hi Ravi,

    It's not possible to pass a value to a getter variable. It seems getter methods get executed exactly once and are then cached in the background so if your VF page calls the same getter twice, it will simply receive the data from the first execution and the getter code will not be executed again.

    Thanks

  • Surbhi

    Member
    May 24, 2016 at 10:51 am in reply to: How can you detect the current Logging Level in Apex?

    Hi Himanshu,

    I don't think there is any way to check the current logging level in apex.

    Thanks

  • Surbhi

    Member
    May 24, 2016 at 10:45 am in reply to: SOQL result ordering in the absence of an Order By clause

    Hi Himanshu,

    There is no guarantee of the order of results unless you used an "ORDER BY" in your query.

    Thanks

  • Hi Himanshu,

    The problem was with initializing the DateTime variable by casting from a Date. Instead of directly casting the Date to a DateTime, the DateTime.newInstance(date, time) method should be used to construct the DateTime in the local time zone as Date doesn't have any time zone.

    Thanks

  • Surbhi

    Member
    May 24, 2016 at 10:33 am in reply to: What sObject properties don't cause triggers to fire?

    Hi Ravi,

    You can better look on the below url:

    https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm

    This is consists of "Triggers and Order of Execution". I hope this will help you to understand the flow of execution.

    Thanks

  • Surbhi

    Member
    May 24, 2016 at 10:07 am in reply to: Is there any way to move fields of custom object to opportunity?

    Hi Nitish,

    You can create the new fields of opportunity with same API name as of the fields of custom object but you can't just move that field directly to the Opportunity.

    Thanks

  • Surbhi

    Member
    May 24, 2016 at 9:58 am in reply to: What objects are available for triggers?

    Hi Himanshu,

    We can write triggers on multiple standard object and all custom object. But if you are using Eclipse IDE then there is an easy way. When you select new ApexTrigger, it will give you all available object on which you can create trigger.

    Thanks

  • Surbhi

    Member
    May 24, 2016 at 9:38 am in reply to: How to check a string has only numbers?

    Hi Ravi,

    Below is the code for your requirement:

    String numVal = '123';
    system.debug('numVal::'+numVal.isNumeric()); // Writes "numVal::TRUE" to the debug log

    Thanks

  • Surbhi

    Member
    May 24, 2016 at 8:04 am in reply to: REST API query to get all accounts which have child records?

    Hi Himanshu,

    Here is the query:

    "SELECT Id, Name FROM Account WHERE Id IN (SELECT AccountId FROM Contact)"

    Thanks

  • Surbhi

    Member
    May 24, 2016 at 7:56 am in reply to: What is the Actual meaning of ALL ROWS in Salesforce SOQL?

    Hi Himanshu,

    SOQL statements can use the "ALL ROWS" keywords to query all records in an organization, including deleted records and archived activities. You can use ALL ROWS to query records in your organization's Recycle Bin.

    But, you cannot use this keywords with the "FOR UPDATE" operation . This is supported by apex, but does not supported by developer console. 

    Thanks

  • Surbhi

    Member
    May 24, 2016 at 7:29 am in reply to: Change picklist according to Formula field.

    Hi Sourabh,

    This requirement can be achieved by two ways:

    1. Field update using workflow. But you have to create unique workflow for each possible picklist value.
    2. Using process builder.You can have entry criteria as per your requirement. The formula for update record will be : IF(FormulaFieldName,'Active','Inactive').

    Thanks

  • Surbhi

    Member
    May 24, 2016 at 6:48 am in reply to: How to create customer community in Dev org?

    You can create Customer Community in Dev org using following steps:
    Setup -> Customize -> Communities Settings.

    You have to first enable communities. Then with specific domain name, you can create customer community.

    Thanks

Page 8 of 8