0

I would like to create a new role for the field Roles on the object AccountContactRelation. How can I create the role entry in test? I could only create the role using the user interface.

6
  • The field Role is a picklist, right? I am not sure if you could change a picklist value thu apex, for example. What is your requirement?
    – m Peixoto
    Commented Jul 27, 2020 at 12:35
  • I found here a reference -> salesforce.stackexchange.com/questions/49057/…
    – m Peixoto
    Commented Jul 27, 2020 at 12:39
  • Hi @mPeixoto, currently I am using the already created roles in AccountContactRelation.Roles; however, if one removes the role I am using to test, then the test will fail... for this reason I would like to create a new role during test so that it does not depend on the changes the users perform in Roles field. Commented Jul 27, 2020 at 12:49
  • 2
    Well I would say that is part of the process. If someone removes the role, they should first do it in lower sandboxes and run all tests to confirm if it breaks anything. If you would like to provide a meaningful message in your test, you can assert that the role picklist contains the value you are using by describing it first and then use it.
    – manjit5190
    Commented Jul 27, 2020 at 13:15
  • 1
    I thought about this issue and I had other idea. You could get a valid role instead of create a new one?
    – m Peixoto
    Commented Jul 28, 2020 at 8:28

0

You must log in to answer this question.

Browse other questions tagged .