Skip to main content
Antonio Manente perguntou em #Apex
I'm creating a quote object dynamically, and everything works fine but I'm stuck trying to assign my lookup relationship to account. I can't find any docs on this and was wondering if anyone has done something similar. Here's an example of what I'm trying to do:

 

Schema.SObjectType quoType = Schema.getGlobalDescribe().get('quote');

sObject quo = quoType.newSObject();

//This works just fine

quo.put('Email', 'generic@email.com');

//I've tried different variations of this, none seem to work

quo.put('AccountId' , SOME_ID);

quo.put('Account', SOME_ID);

Any help is greatly appreciated, thanks in advance!
2 respostas
  1. 20 de nov. de 2015, 02:56
    This is because the AccountId field is not editable.  You have to set the OpportunityId field and then it will pull the AccountId field from the Opportunity.

     

    quo.put('OpportunityId', oppId);

     
0/9000