• Usman Aslam
  • NEWBIE
  • 40 Points
  • Member since 2015
  • Salesforce Consultant
  • Sky Computing Solutions/Magnet 360


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 10
    Replies
I have third party application that upserts data in salesforce.com. How many API calls a single upsert operation consumes provided the batch is set to 2000 records. This is SOAP based integration without Bulk API
  • June 30, 2015
  • Like
  • 0
What is the recommended approach by Salesforce for mobile application authentication?
 - SAML based authentication?
 - OAuth User-Agent flow?
 - OAuth Username-Password Flow?
 - Session Id flow?

Here is my understanding:
SAML seems out question, because it involves identity provider and in most cases we don't utilize an ID provider.

In User-Agent flow we need a connected app and don't have to provide password at all and access token is sent to pre-defined callback URL. Which is not happening in all of the mobile applications available, such Salesforce1.

Salesforce1 app seems close to OAuth Username-Password Flow but we don't have to provide security token. We can login to any instance with a valid username and password and our IP is not white listed either. How can we authenticate without a security token? I believe there is a browser plugin running in the Salesforce1 app and we have to tap 'Allow' access after login and have to provide verification code as well (one time only). Tapping 'Allow' and verification code is alternative to security token?

I don't know anything anout session Id flow and didn't find any details.

I am NOT looking for code, just a general opinion about the best approach from the four option above.

Thanks in advance.

Usman
What is the recommended approach by Salesforce for mobile application authentication?
 - SAML based authentication?
 - OAuth User-Agent flow?
 - OAuth Username-Password Flow?
 - Session Id flow?

Here is my understanding:
SAML seems out question, because it involves identity provider and in most cases we don't utilize an ID provider.

In User-Agent flow we need a connected app and don't have to provide password at all and access token is sent to pre-defined callback URL. Which is not happening in all of the mobile applications available, such Salesforce1.

Salesforce1 app seems close to OAuth Username-Password Flow but we don't have to provide security token. We can login to any instance with a valid username and password and our IP is not white listed either. How can we authenticate without a security token? I believe there is a browser plugin running in the Salesforce1 app and we have to tap 'Allow' access after login and have to provide verification code as well (one time only). Tapping 'Allow' and verification code is alternative to security token?

I don't know anything anout session Id flow and didn't find any details.

I am NOT looking for code, just a general opinion about the best approach from the four option above.

Thanks in advance.

Usman
List<Decimal> cal =new List<Decimal>();
public decimal fun(){
cal.add(0.0);
cal.add(0.1);
return cal;  // This is possible, But when I have to return that time to display error: "Return value must be of type: Decimal at line"
}

If any one know how to return the list decimal value into function.
I have third party application that upserts data in salesforce.com. How many API calls a single upsert operation consumes provided the batch is set to 2000 records. This is SOAP based integration without Bulk API
  • June 30, 2015
  • Like
  • 0
In SalesForce, we would like to add a field (or multiple) for all of our accounts that designates them to a certain route. The format of this field would look something like : RouteName-#, 
where # denotes the position of the account for that RouteName. For example, if there are 50 accounts in 5CHA route, the field (let's call this Route Position) for all those accounts will start off as 5CHA, but will all have a unique position from 5CHA-1 to 5CHA-50. 

What we are hoping to achieve is to this field automatically increase or reduce for all affected accounts when we add or remove accounts, respectively, from the same route. The overall route order will most likely not change. For example, we have decided a new account will be in Route Position 5CHA-23, after the current 5CHA-22 but before the current 5CHA-23. This will place the new account at 5CHA-23, while all the subsequent account starting 5CHA-23 to 5CHA-50 will be updated by a +1 in their position. Similar trend will apply for when we are removing an account with a -1 to their Route Position. 

With that said, there will be no duplicates in Route Position for any accounts. There might be cases where an account might have up to 3 route positions if they belong in 3 different routes. 

Route is a multi-picklist field on accounts object.
I edited my class and saved it successfully but when I accessed my page which uses the class, I get an error of
DML currently not allowed
An unexpected error has occurred. Your development organization has been notified.

controller
public class DefinitionController {

    public DefinitionController() {
            this.DefTable();
    }

  public void DefTable(){
    listplatforms = [select Name,Status__c from Platform__c];

      for(Platform__c idlistplatforms : [select Id from Platform__c]){
        List<Def__c> existplatforms = [select Platform__c from Def__c where Platform__c=:idlistplatforms.Id];

            if(existplatforms.size() > 0)
            {
                idlistplatforms.Status__c = 'Set';
                //update idlistplatforms;
                System.debug('Found'+ idlistplatforms);
            } 
            else 
            {
                idlistplatforms.Status__c = 'Not Set';
                //update idlistplatforms;
                System.debug('Not Found'+ idlistplatforms);
            }
            update idlistplatforms;
      }
  }
    
}
I think the problem is because of the update part. How do I overcome this error?

Thanks in advance !

 
Hi All

I am facing error in my Apex code .Like

Visualforce ErrorHelp for this Page
System.ListException: DML statment found null SObject at position 0
Error is in expression '{!savebook}' in component <apex:commandButton> in page try2: Class.MultiAdd11.savebook: line 25, column 1
Class.MultiAdd11.savebook: line 25, column 1




Pls help me....

VF Page
-------------
<apex:page StandardController="BankBook__c" extensions="MultiAdd11" id="thePage" sidebar="false" showHeader="false">
 <apex:define name="body">
            
            <div style="width:1000px;margin: 10px auto 10px auto;">
             <apex:image id="theImage" value="{!$Resource.Emami}" width="100" height="100"/>
<apex:form >
 
          
 
 
        <apex:pageblock id="pb1" title="Book Entry Form"> 
        
        
 <b>Transcation Date:</b><apex:inputfield value="{!Con1.Txn_Date__c}"/><br/> 
        
    <apex:outputPanel id="panel">

            <apex:outputText value="{!Con1.Txn_Date__c}"/>

    </apex:outputPanel>
                                    
 
                <apex:pageblocktable value="{!lstInner}" var="e1" id="therepeat">
 
                   <apex:column >
 
                    <apex:facet name="header">Debtor Code</apex:facet>
 
                     <apex:inputfield value="{!e1.con.Entries_Code__c}"/>
 
                   </apex:column>
 
                   <apex:column >
 
                   <apex:facet name="header"> Debtor Name</apex:facet>
 
                     <apex:inputtext value="{!e1.con.Debtor_Name__c}"/>
 
                   </apex:column>
 
                   <apex:column >
 
                   <apex:facet name="header">Payment Type</apex:facet>
 
                     <apex:inputfield value="{!e1.con.Credit_Debit__c}"/>
 
                   </apex:column>
 
                   <apex:column >
 
                   <apex:facet name="header">Amount</apex:facet>
 
                     <apex:inputfield value="{!e1.con.Amount__c}"/>
 
                   </apex:column>
                   <apex:column >
 
                   <apex:facet name="header">Narration</apex:facet>
 
                     <apex:inputfield value="{!e1.con.Narration__c}"/>
 
                   </apex:column>
                   
                   
                    <apex:column >
 
                   <apex:facet name="header">Add</apex:facet>
 
                     <apex:commandButton value="+" action="{!Add}" rerender="pb1"/> 
 
                   </apex:column>
 
                   <apex:column >
 
                   <apex:facet name="header">Del</apex:facet>
 
                      <apex:commandButton value="X" action="{!Del}" rerender="pb1">
 
                        <apex:param name="rowToBeDeleted" value="{!e1.recCount}" assignTo="{!selectedRowIndex}"></apex:param>
 
                        </apex:commandButton>
 
                   </apex:column>
 
                  
 
                </apex:pageblocktable>                
 
           

 
    <apex:pageBlockButtons location="bottom">        
 
        <apex:commandbutton value="SUBMIT" action="{!savebook}"/>
         <apex:commandbutton value="PREVIEW" />
          <apex:commandbutton value="CANCEL" />
 
    </apex:pageBlockButtons>  
</apex:pageblock>
 
</apex:form>
 </div>
        </apex:define>
        <apex:form >
        <apex:pageBlock title="Entry List">
                    
       
        </apex:pageBlock>
        </apex:form>
</apex:page>

Apex Class
---------------
public class MultiAdd11{    
 
    public List<BankBook__c>lstAcct  = new List<BankBook__c>();
 
    public List<innerClass> lstInner{get;set;}
 
    public String selectedRowIndex{get;set;} 
    public List<BankBook__c> lst{get;set;} 
    public BankBook__c Con1 { get; set; }
 
    public Integer count = 1;
 
                
 
    public PageReference savebook(){
 
        PageReference pr = new PageReference('/apex/Try2');        
 
        for(Integer j = 0;j<lstInner.size();j++){
 
            lstAcct.add(lstInner[j].acct);
 
        } 
 
        upsert lstAcct;
 
        pr.setRedirect(True);
 
        return pr;
 
    }
 
         
 
    public void Add(){   
 
        count = count+1;
 
        addMoreRows();      
 
    }
 
     
 
    public void addMoreRows(){      
 
      innerClass objInnerClass = new innerClass(count);
 
      lstInner.add(objInnerClass);          
 
    }
 
     
 
    public void Del(){      
 
      lstInner.remove(Integer.valueOf(selectedRowIndex)-1);
 
      count = count - 1;        
 
    }
    
    
     
                 
 
    public MultiAdd11(ApexPages.StandardController ctlr){    
 
       lstInner = new List<innerClass>();
 
       addMoreRows();
 
       selectedRowIndex = '0';   
       Con1 = new BankBook__c();     
 lst=[select id,Entries_Code__c,Debtor_Name__c,Credit_Debit__c,Amount__c from BankBook__c];
    }
 public PageReference refresh() {
        return null;
    }

  
    public class innerClass{               
 
        public String recCount{get;set;}                
 
        public BankBook__c acct{get;set;}
 
        
 
        Public BankBook__c con{get;set;}
 
        public innerClass(Integer intCount){
 
            recCount = String.valueOf(intCount);                                
 
            con = new BankBook__c();            
 
        }
 
    }
 
}

 
trigger accountTestTrggr on Account (before insert, before update){
     for(Account a: Trigger.new){
List<Contact> contacts = [select id, department, firstname, lastname, email from Contact where accountId = :a.Id];
                       
           
     for(Contact c: contacts){
          System.debug(Contact Id[' + c.Id + '], FirstName[' + c.firstname + '],LastName[' + c.lastname +']);                                
         c.Description=c.department+ ' ' + c.firstName + ' ' + c.lastname;               
         update c;
     }      
      }