You need to sign in to do that
Don't have an account?
hemm
Trigger fails when License Manager submits a Lead
I wrote the following trigger.
The code adds a Campaign Member record automatically if it can find a Campaign with a name matching the Lead Source name.
All is great when I use the application and with web-to-lead. However, License Manager submitted a Lead/License today and I got the following email.
That user id is one of the License Manager users that gets created behind the scenes. The end result is that the License record gets created, but the Lead does not.
Is there anything I can do to make this get fixed? I was thinking I could edit the API Access Restrictions on the License Manager installed package to give access to Campaigns. Will that help?
If that won't help, do I need to edit my Apex Code to do a user lookup to make sure it's not an LMA user? Or can I do a describeGlobal type of query to make sure the user has access to Campaign? If that's the route to take, I could use a little help.
Thanks.
Code:
trigger Create_CampaignMember_For_New_Leads on Lead (after insert) { List <CampaignMember> cm = new list<CampaignMember>(); for(Lead L : Trigger.new) { String cname = L.leadsource; List <Campaign> c = [select id, name from Campaign where name = :cname limit 1]; if(!c.isEmpty()){ CampaignMember cml = new CampaignMember(); cml.campaignid = c[0].id; cml.leadid = l.id; cm.add(cml); } } if(!cm.isEmpty()){ insert cm; } }
All is great when I use the application and with web-to-lead. However, License Manager submitted a Lead/License today and I got the following email.
Code:
Apex script unhandled trigger exception by user/organization: 0053000000125N9/00D300000007gjY Create_CampaignMember_For_New_Leads: compiling trigger body caused by: line 15, column 29: sObject type 'Campaign' is not supported.
Is there anything I can do to make this get fixed? I was thinking I could edit the API Access Restrictions on the License Manager installed package to give access to Campaigns. Will that help?
If that won't help, do I need to edit my Apex Code to do a user lookup to make sure it's not an LMA user? Or can I do a describeGlobal type of query to make sure the user has access to Campaign? If that's the route to take, I could use a little help.
Thanks.
Start by checking the profiles for marketing checkbox( campaigns), then see if this object has been hidden from some profiles.
License Manager users are not visible in the UI, but I used the Excel Connector (thanks for building that, by the way.) to try that. Updating that value on any License Manager record gives the following error:
All of the License Manager users use a profile called "Package License Manager" and this profile is not accessible in the UI. I looked at the profile in the Excel Connector and I went so far as trying to give that profile the Modify All Data permission. Here's the error I get:
You may not turn on permission ModifyAllData for this License Type : Permissions
Of course if the whole purpose of this was to enhance license manager, then that really wont work. We've developed a Campaign Member 2.0 functionality that would sit on top of Campaign Members but add additional fields and functionality. You could leverage this concept to have the trigger create a CampaignMember2.0 object where you are the owner, and then use another trigger to create a standard campaign member based on that custom object. Since you are the owner of the custom object, I think the trigger will create the standard campaign member using your userId instead of the license manager's.
Email me if you want the xml to paste into Eclipse to update your config via the metadata API.
-Matt
The populating of another object to then populate the campaign members it not practical.
You shouldn't have to wait till LMA 2.0.
And the Test:
I was not receiving any error emails, though. The issue could be that the License Manager user 1) is not a Marketing User and 2) cannot be granted permission to use my Apex classes since I can't see the profile that user uses. It's all hidden from me.
It's really hard to test and be certain, but the circumstances lead me to believe there is still a problem.
I'm happy to test this with you at some point.
It was for a different object (Case) but exactly the same issue - LicenseManager does not have the privileges to see cases and I don't have the privileges to see/modify the licensemanager user (I have the System Administrator profile in SF).
I can't try in dev as I don't have google adwords in dev and do not want to put this live again only for it to fail.
Not sure if there's some other way to test this?
EDIT: FYI last time this was in production and it failed was: 10th April 2008
Message Edited by jeremy_w on 06-24-2008 10:30 AM
1. Enable your trigger on Leads in your LMO org.
2, Subscribe to a new DE org.
3. Install your package in DE org from step 2.
4. Within a few minutes, a lead and a license record should be created in your LMO org for the package install in the DE org.
5. If messages don't get delivered, disable the trigger. Wait at the most an hour and see if the license gets created.
We tested this internally and there doesn't seem to be a problem anymore. But, feel free to check yourself and let us know if there is an issue.
But I decided to try my trigger in production and it now works fine so far. No errors relating to LicenseManager not having the access to see Cases.
So, thank you.
I'd like to know where I can see a list of these bug fixes that get released quietly. Can you post a link to where this information is?
Jeremy
Do I need to update my triggers/classes to use the 13.0 API for this to be fixed or was it all on the Salesforce side?