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
Piotr@ProntoPiotr@Pronto 

Apex code help - cross object update (custom to standard)

Hi everyone,

 

We're looking to implement a trigger that's based on certain criteria from Subscription object (custom): Zuora__SubscriptionProductCharge__c , updates will be made to Account object (standard). Here's the logic:

 

- if Product_SKU__c equals "A-100001" and Status__c equals "Active" (both under Subscription object) then Social_Media__c (checkbox field under Account equals "True")

- of course after the update, if Status_cc becomes "Inactive", Social_Media__c should become "False"

- please note there could be a few subscriptions with the same data

 

Could someone help come up with the code as well as test code?

 

I'm new to Apex code and since last month I'm trying to learn and find my way around it. So far, my knowledge is very limited.

 

I'd appreciate anyone's help!

 

Thanks

Piotr

SaxonSaxon

Hi Piotr,

 

Are you looking to chage the fields of account when ever changes made to your custom object??

- insert.

-update.

 

Regards,

Saxon.

Piotr@ProntoPiotr@Pronto

Well it's a little more complicated than that.

 

Subscriptions are inserted in Zuora (another application) and are automatically synced with SFDC so they show up under this custom object.

 

Based on that we'd like Account object to be updated, it should all happen automatically so when a subscription is inactive, changes are again made to Account as described above.

 

Is it possible?

 

THanks

Piotr

Venkat_rdVenkat_rd

Hi,

If I understand corectly, even if one subscription matches your criteria then Account subscription should be ture else false.

you have to write trigger on Custom object with criteria before insert,before update and before delete and have to create a map of map<Id(account),list<customobjects)> and then run through each subscription of account and if any one is true make account subscription as true else false

 

Thanks,

Venkat


Piotr@Pronto wrote:

Well it's a little more complicated than that.

 

Subscriptions are inserted in Zuora (another application) and are automatically synced with SFDC so they show up under this custom object.

 

Based on that we'd like Account object to be updated, it should all happen automatically so when a subscription is inactive, changes are again made to Account as described above.

 

Is it possible?

 

THanks

Piotr