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
lopezclopezc 

create CampaignMember from Sites

I have created a site with a very simple form. It only should creates CampaignMembers but it is failing:

 

Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

 

The Site user has profile "Guest User License". I gave him permissions to read and create campaigns but I don't know how to give him permissions to create Campaign members. Any idea?

 

Thanks!!

David VPDavid VP
If you create campaign members, you need to put in a link to the contact or lead. My guess is that the Guest profile will need at least read rights on contact or lead (depending on which one you're using).
jkucerajkucera

Another option if you're always looking to create leads as well is to use web to lead & pass the campaignID

 

http://blogs.salesforce.com/marketing/2007/03/autoassociating.html

 

DVP is right - to create new campaign members, the following is needed:

 - Edit on Lead or Contact

 - Read on Campaigns

 - Sharing privledges to view that Lead or Contact

Guest User is like another user - if they can't see the lead or contact due to private sharing, then they can't create a CM for it.  You'd have to have a sharing rule to open it up if your model is private.
Message Edited by jkucera on 10-27-2009 01:44 PM
lopezclopezc

I gave permissions to read/edit on Lead and Contacts, I also gave permissions to the user to read on Campaigns and every single custom object and I still don't know why it is not working.

 

There is also another problem. Before creating the CampaignMember the code looks for a matching contact based on the email. For this specific example, the contact exists so it should find it and create the campaign member attached to it (I am not always looking and creating leads, only if the contact doesn't exist, so I don't want to use WebToLeads). The problem is that it doesn't find it! The query returns an empty list so a lead is finally created.

 

To see where the problem was I have created a test method that does exactly the same thing (submit a form) and runAs the "Site user" and the weird thing is that it worked!! So it must be something different with the Site, but the user as permissions to see the contact and create the campaignMember in the test method:

 

 

static testMethod void myUnitTest() {
List<User> user = [Select Id from User where ProfileId = '00eR0000000IEzw'];
System.assertEquals(user.size(), 1);
System.runAs(user.get(0)){//Member4 is an existing contact in the data Base


WebinarProcessor.updateCampaignWithWebinar('Member4', 'Member4', 'member4@member4.com', 'sv_SE', 'igi', '701R00000002F3o');
}
}

 

Message Edited by lopezc on 10-28-2009 04:51 AM
jkucerajkucera
Do you have a private sharing model?  Does the Guest User have sharing on those records?
lopezclopezc
Sorry I am completly lost with that, what is a sharing model? How can I make a user to share records?
jkucerajkucera

Follow this click path:

Setup-->Administration Setup-->Security Controls-->Sharing Settings-->Edit

 

If any of Lead, Contact, or Campaign are private, then that means only the owner of the record can view those leads, contacts or campaigns, and has implications for campaign member as well.

 

If they are Public, then sharing isn't the problem here.

 

If they are private, you'll need to set up sharing rules, which are rules that say who can see what, and specifically give the Guest User access to the leads & contacts that are campaign members (or all leads & contacts if that's easier).

lopezclopezc

yes, I found it, they both appear to be private, thanks!

 

Now, i want to give permissions to only my "Site User". I have set up a public group with my user but in the page when setting up a sharing rule it ask me for which leads I want to share with that group ("Leads owned by memebers"). I just want to give it permissions to All leads in my organisation. how do I do that?Do I have to create a public group with all my users? is there not something by default like 'sharing All' ?

 

thanks

Message Edited by lopezc on 10-29-2009 03:09 AM
lopezclopezc

Oh actually no worries, I found the answer myself: Roles and Internal Subordinates (System Administrator)

 

Thanks for the help!!

David DanzigDavid Danzig

We are running into the same problem - can't make an attached Campaign Member record - even though we have a Sharing Rule set for that User. It seems that the Lead.ConvertedContactID field is not available via the Sites form when inserting a new Lead which is converted to a Contact upon insert by code we have in place. And this is the case even when running in System mode.

 

Please help.

 

Thanks,

David.

jkucerajkucera

The Guest User has sharing access to both the converted lead and the new contact?

 

Does the guest user have Edit on both lead & contact as well?