1

I'm working in Python and trying to use the SOAP Api to update ApexTrigger statuses. I keep getting the following error:

[{'errors': [{'fields': [], 'message': 'insufficient access rights on cross-reference id', 'statusCode': 'INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY'}], 'id': '', 'success': False}]

I am using the beatbox library and my code looks something like this;

svc.login('XXXX', 'XXXX')
print svc.serverUrl

query = ("SELECT Id,Status,ApiVersion FROM ApexTrigger")
res = svc.query(query)

print 'Updating Trigger...'
test_trigger = res[0]
test_trigger['Status'] = 'Inactive'
res = svc.update(test_trigger)
print res

I am not sure if my code is wrong or if salesforce allows you to update this field?

Thanks in advanced.

2 Answers 2

3

You are trying to run Update on ApexTrigger via Metadata API.
According to the documentation:

This metadata type is not supported by the create(), delete(), and update() calls.

In order to update a trigger via Metadata API you need to use a file based call: deploy()

FYI - Metadata update() call is deprecated. You should not be using it for anything, even for components that support update. Use updateMetadata() or renameMetadata() instead (note, this does not apply for ApexTrigger, use deploy() for this one)

2
  • This turns out to be the answer. you can only update this via the Metadata Api. Commented Aug 4, 2015 at 14:50
  • Don't forget about the Tooling API. You can use that to update triggers, too.
    – sfdcfox
    Commented Aug 4, 2015 at 14:55
0

The permissions of the user which you are logging in as are not set correctly to allow the modification. Sometimes this means enabling create on a related object that you may not believe needs that privilege.

http://www.forcetree.com/2011/12/insufficientaccessoncrossreferenceentit.html

Some quick notes from the article:

Things to check:

  • Check that the running user (in this case you) has access to the object in question. Check that the user has CREATE privileges on the object. This is optional, but is always better to start from here.
  • Check that the Owner i.e.: User X has CREATE permission on the object. Check that the user's profile has the CREATE permission on the particular object. The user might not have it, grant the user permission and the issue is resolved.

You must log in to answer this question.

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