function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jOseMCjOseMC 

I need to use a field that doesn't belong to a certain object, how do I use this field in the object I need?

Hey guys, I need to use the BankId__c field in the account object, but it is not available in the account object, but in the serviceContract, how do I solve this problem?
in the code below if I receive the Account Source with the value of SELF_SIGNIN and the value that I had defined in this field is that the type of Account source with this value SELF_SIGNIN has a null bankId and it has to receive the values ​​of contractChangeRequest.BankId from
if (account.AccountSource == AccountSource.SELF_SIGNIN.toString(){
            Account.BankId__c  =  contractChangeRequest.BankId__c;
             Database.update(newContractChangeRequest);

when I search for the bankId it does not appear
 
AnkaiahAnkaiah (Salesforce Developers) 
Hi jOseMC,

You can create BankId__c field on account object with same datatype as in contract (BankId__c) object will resolve the issue.

If this helps, Please mark it as best answer.

Thanks!!



 
jOseMCjOseMC
bro, this is in a company that I work, my friend told me to look for other ways to find this field, through a referencing
AnkaiahAnkaiah (Salesforce Developers) 
Can you clarify the below.

As per your code, when account source is SELF_SIGNIN then you need to fetch the BankId__c field value from serviceContract to account record. Am i correct?

If my understanding is correct then which field you need to update on account with the value of  serviceContract(BankId__c )?

Thanks!!
jOseMCjOseMC
the context of the task is if the account source comes as I specified it comes from another class with the following empty fields
(serviceContract.BankId__c, serviceContract.Conta__c, serviceContract.Agencia__c)

right? from that I need my code to receive the values ​​of the empty fields of the contractChangeRequest
jOseMCjOseMC
the context of the task is if the account source comes as I specified it comes from another class with the following empty fields
serviceContract.BankId__c && serviceContract.Conta__c && serviceContract.Agencia__c


right? from that I need my code to receive the values ​​of empty fields directly from contractChangeRequest