1

I am trying to write a trigger on the License object (sfLma__License__c) in my License Management org.. the purpose of this trigger to make a callout (in a future context) to my service to notify it of any new licenses or updates..

This is my trigger as of now

trigger MyLicenseTrigger on sfLma__License__c (after insert, after update) {

    for(sfLma__License__c newLicense: Trigger.newMap.values()) {
        LmoCalloutHelper.reportLicense(newLicense);
    }
}

Now if I update any editable field of this license from the UI (for eg. the Lead field) the trigger fires.. all good.

But if the managed package which is linked to the LMO is installed or uninstalled, the trigger does NOT fire.

On digging a bit, I see that on install/uninstall, the License Status is changed. But License Status is a formula field which obviously doesnt fire triggers.

But the formula field is just a $recordType.Name, so basically it seems any install/uninstall updates the Record Type of a license record.

So on install/uninstall of a package, if the Record Type is updated, why does my trigger not fire?

3
  • My guess is that triggers are not supported on this object. This is the case for various special Salesforce objects.
    – Phil W
    Jan 2 at 9:17
  • 1
    @PhilW if I do an update from the UI (if I change the Lead field for instance) it fires so I don't think thats the issue
    – SatheeshJM
    Jan 2 at 9:43
  • Some operations on Salesforce realm doesn't fire triggers, have you checked the documentation to see if this operation is one of them? If is, I recommend to you create a schedulable flow to verify the record types, create a field like, old record type, store the value in the first run of the flow, after update it when it changes Jan 6 at 15:20

1 Answer 1

-1

it does not trigger because recordType.Name is like a change on the parent record, not on the sfLma__License__c record itself.

if you update the recordTypeId of your sfLma__License__c record, the trigger will fire.

But updating the name of the 'parent' recordtype record, will not fire a trigger on the 'child' record, since the 'child' record is still linked to the same 'parent' record (the recordTypeId is the same).

1
  • recordType.Name is NOT what is being changed here.. Its just the value of the formula field. lwhen a managed package is uninstalled, the sfLma__License__c moves from Active -> Uninstalled That means the recordTypeId of the sfLma__License__c object itself is changing here (and hence the formula field will be updated) since the recordTypeId is changed, the trigger should have fired right?
    – SatheeshJM
    Jan 2 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.