将标准对象设置为salesforce中的自定义对象字段

时间:2016-02-14 09:21:20

标签: salesforce apex

我想将标准对象设置为自定义对象的字段。

Account a = new Account();

Customer__c sss = new Customer__c();

sss.Ref_Account__c --> this is a field that takes  an 'Account' object.
sss.Ref_Account__c = a; This gives me error.

2 个答案:

答案 0 :(得分:0)

Account a = new Account();

Customer__c sss = new Customer__c();

//sss.Ref_Account__c --> this is a field that takes  an 'Account' object.
sss.Ref_Account__c = a.Id;

答案 1 :(得分:-1)

您需要像这样编码 sss.Ref_Account__c = a.Ref_Account__c;