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
    Commented Jan 2, 2023 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
    Commented Jan 2, 2023 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 Commented Jan 6, 2023 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
    Commented Jan 2, 2023 at 16:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .