+ Start a Discussion
ra1ra1 

setting Parent Id in sforce.one.createRecord

Hi All,

I am very new to Salesforce1 and currently working on one POC. Here I created one Object-Specific Action (using  custom VF Page) on "Account" object. This VF page will all list of Case RecordType name (just like regular record type selection page) with some custom filtering.

On selecting appriopriate Case' RT, I have to redirect user to Case creation page with prepost Account value, below is my sample code 

Please guide me, below is my code.

Thanks in advance!!

<script>
          function createServiceTicket() {
              var e = document.getElementById("{!$Component.form.CaseRecordTypeSelect}");
              var caseSelected = e.options[e.selectedIndex].value;
             
              var caseMainRT = '012i0000001IP0t';
              var caseSecondRT = '012i0000001IP0y';
             
              var selectedRT = null;
              if(caseSelected == 'Second RT') {
                  selectedRT = caseSecondRT;
              } else {
                  selectedRT = caseMainRT;
              }
             
              sforce.one.createRecord("case", selectedRT);
        }
      </script>

<apex:form id="form">
    <apex:outputPanel id="FormPanel">
        <apex:outputLabel >Select Service Ticket Type</apex:outputLabel>
        <apex:selectList value="{!selectType}" size="1" id="CaseRecordTypeSelect">
            <apex:selectOptions value="{!serviceTktTypeItems}"></apex:selectOptions>
        </apex:selectList>
    </apex:outputPanel>
    <section class="data-capture-buttons one-buttons">
    <div class="content">
        <section class="data-capture-buttons one-buttons">
             <a href="#" id="createServiceTicket" onClick="createServiceTicket();" style="text-transform: none;" >Proceed</a>
        </section>
    </div>
    </section>
</apex:form>
Ashish_SFDCAshish_SFDC
Hi , 


See the links belwo for getting / setting parent ID in publisher actions, 

item.ParentId=accId;

http://bobbuzzard.blogspot.in/2013/07/publisher-actions-not-just-creating.html

navigateToRelatedList(relatedListId, parentRecordId) Navigates to the related list as specified by the relatedListId. The parentRecordId is the record of the parent object. For example, for a related list of Warehouses, the parentRecordId would be Warehouse__c.Id.

http://www.salesforce.com/us/developer/docs/salesforce1/Content/vf_dev_best_practices_navigation.htm

See the usage of perent id: Salesforce1 Demo: Building an Expense Tracker

http://www.eltoro.it/ArticleViewer?id=a07A000000T3GOpIAN

2) ParentId :- ID of the object type to which the is related. For example, set this field to a UserId to post to someone’s profile feed, or an GroupId to post to a specific Group.

https://rakeshistom.wordpress.com/category/salesforce1/


Regards,
Ashish