• JackOdell
  • NEWBIE
  • 25 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 8
    Replies

Hey folks.

 

Is it possible to convert an Account to a Person Account via a Trigger?  Or are Batch Apex and Data Loaders the only way?

Hey folks. 

 

Our team needs to be keep records in synch between our app and Salesforce.  We will be updating PersonAccounts and Cases.  

 

We're considering using the REST API to update the records using a foreign key from our app.

 

Can anyone think of any drawbacks to using foreign keys with the REST API?  Are there things we won't be able to do?  Would it be more advantageous for us to store the Salesforce record ID in our app?

 

Thanks in advanced.

Hey folks.

 

Is it possible to convert an Account to a Person Account via a Trigger?  Or are Batch Apex and Data Loaders the only way?

Hey folks. 

 

Our team needs to be keep records in synch between our app and Salesforce.  We will be updating PersonAccounts and Cases.  

 

We're considering using the REST API to update the records using a foreign key from our app.

 

Can anyone think of any drawbacks to using foreign keys with the REST API?  Are there things we won't be able to do?  Would it be more advantageous for us to store the Salesforce record ID in our app?

 

Thanks in advanced.

I have a very simple XSD that I'm trying to include in my WSDL to alllow the Apex code to be generated.  The XML here is this:

<GetJurisdictions>
    <params>
      <param name="contactNo">11</param>
      <param name="loginGuid">abc123</param>
   </params>
</GetJurisdictions>

 

We could write the inline XSD a number of ways.  Here is one way:

<s:schema xmlns:s="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
<s:element name="GetJurisdictions">
<s:complexType>
<s:sequence>
<s:element ref="params"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="param">
<s:complexType id="val1" mixed="true">
<s:simpleContent>
<s:extension base="s:string">
<s:attribute name="name" type="s:string"/>
</s:extension>
</s:simpleContent>
</s:complexType>
</s:element>
<s:element name="params">
<s:complexType>
<s:sequence>
<s:element ref="param" maxOccurs="unbounded"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>

 

Here is the Apex code generated for the "param" element:


public class param_element {        

public String name;        

private String[] name_att_info = new String[]{'name'};        

private String[] apex_schema_type_info = new String[]{'http://xxx.com/','true','false'};        

private String[] field_order_type_info = new String[]{};    

}

 

The problem is when the Apex code is generated, there is no way for me to set the param "element" content.  I can set the attribute "name" no problem.  I.e., in the XML example above, how do I set the "11" or "abc123"?  Any suggestiongs greatly appreciated.  

  • December 12, 2012
  • Like
  • 0

if(s.Approval_Status__c=='Order Canceled' && Trigger.oldMap.get(s.Id).Approval_Status__c == 'Approved by First Level'){
          for(Sample_Line_Item__c sli:s.Sample_Line_Items__r){
                    productIds.add(sli.product_No__c);
                    
                    if(s.Distribution_Center__c=='Tokyo')
                    {
                        if(TokyoproductIdToQuantity.get(sli.product_No__c)  == null || TokyoproductIdToQuantity.get(sli.product_No__c) == 0)
                        {   
                        
                            TokyoproductIdToQuantity.put(sli.product_No__c,sli.quantity__c * (-1));
                        }
                        else
                        {
                            Decimal temp = TokyoproductIdToQuantity.get(sli.product_No__c);
                            temp = temp + (sli.quantity__c * (-1));
                            TokyoproductIdToQuantity.put(sli.product_No__c,temp);
                        }
                    }
                
                    if(s.Distribution_Center__c=='Suzuyo')
                    {
                        if(SuzoyoproductIdToQuantity.get(sli.product_No__c)  == null || SuzoyoproductIdToQuantity.get(sli.product_No__c) == 0)
                        {   
                        
                            SuzoyoproductIdToQuantity.put(sli.product_No__c,sli.quantity__c * (0));
                        }
                        else
                        {
                            Decimal temp = SuzoyoproductIdToQuantity.get(sli.product_No__c);
                            temp = temp + (sli.quantity__c * (0));
                            SuzoyoproductIdToQuantity.put(sli.product_No__c,temp);
                        }
                    }
                    if(s.Distribution_Center__c=='Osaka')
                    {
                        if(OsakaproductIdToQuantity.get(sli.product_No__c)  == null || OsakaproductIdToQuantity.get(sli.product_No__c) == 0)
                        {   
                        
                            OsakaproductIdToQuantity.put(sli.product_No__c,sli.quantity__c * (0)) ;
                        }
                        else
                        {
                            Decimal temp = OsakaproductIdToQuantity.get(sli.product_No__c);
                            temp = temp + (sli.quantity__c * (0));
                            OsakaproductIdToQuantity.put(sli.product_No__c,temp);
                        }
                        
                    }   
                
                    sli.Prior_Approved_quantity__c = sli.Quantity__c;
                    sli.Quantity__c = 0;
                    sampleLineItemsToUpdate.add(sli);
                
                }
              
        }