Assigning a record owner to my online customer Booking Form

Hi guys


Love the product! I have one challenge - My customers access my custom booking object (via VisualForce) to make a booking. I allow them to select their Account from a picklist.

What I am trying to do, is set the 'Record Owner' of the Booking to be the Account Owner already assigned under the Account (not the current user that's set for the page). I have tried setting as reference (MyCustomObject__c.OwnerId = Account__r.OwnerId) but no luck.

Could you tell me how I can achieve this?

Many thanks in advance.

Regards


Alex

Answers

  • Hey @Rob Hatch

    I have figured out how to do this now just manually allowing the user to select an account owner from a picklist. However, I am now facing an issue as follows:

    'insufficient access rights on cross-reference id'

    After googling, it seems that it is a Salesforce error related to the following:

    Scenario: When creating a record and attempting to assign it to a new user in the same call

    Possible Cause: Create a record first, and in a separate call update the record with a new OwnerId.


    How can I do this with Skuid - ie. Save the record and then update it after with a changed Owner?

    Thank you


    Alex

  • Is anyone able to assist me with this enquiry??

  • Germany3
    Germany3 🛠️ 
    edited April 15, 2021

    Hey @awebsterx ,


    Sorry for the delay. Question, do your user have access to that record/object? it is possible it's not visible because of its record type.





    Thanks,

  • Hi @Germany3

    Yes the user has access to that user record. The issue is that Skuid complains trying to update the ownership of the record on save.

    Regards

    Alex

  • A couple things come to mind:

    1) Use a salesforce process or flow to update the record owner following save. This would bypass any permissions issues as you would run the process/flow as admin.

    this would solve your problems if there was an issue with the user not having permission to assign an owner other than themselves to the record.

    2) in Skuid, you might be able to use a model action. You could set it to trigger based on model save and have it then update the record owner and re-save. You would have to put it in a branch though to only run the update if the owner is not the owner of the account otherwise it will create a never ending update loop.


    based on your error, I’m not sure #2 will work, but I’m pretty sure #1 will.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!