Skip to main content
I have a custom object called Credentials and it houses details on Salesforce Users, and if they hold credentials for a certain state. I want to create a VLOOKUP function that determines if the Owner of the Opportunity has the appropriate active credentials for the state referenced in the Opportunity.

 

Here are the fields on the objects.

 

Opportunity

  • Owner (standard field)
  • State__c

Credentials

  • Credentials Name (Auto Number)
  • Stage__c
  • Expired__c (checkbox)

For whatever reason, I'm having a really hard time with the syntax of the VLOOKUP function when writing this validation rule. I'm happy to create additional fields if needed to help compare, or change the Credentials Name from an Auto Number to Text if that is needed.

 

Appreciate your help!
7 respuestas
  1. 13 feb 2017, 16:55
    I haven't tried this, but given my experience with vlookups, here's what I would try:

     

    You want to lookup the active status using Opp Owner (User_ID) and Opportunity.State. But, you can only lookup (the 2nd parameter in the vlookup) by matching your value with the Name field on the Credential object. Thus, I think you'll need to a) create a field on the opportunity object that is the concatenated value of Opp Owner and State from the opp object, then have a workflow rule that populates the Credential Name field as the User Id and state for the Credential object. Then the vlookup will use these two fields for the match. They will hold User + state, and you'll return the active status. This will support a user having more than 1 state on the credential table.

     

    You may have to use the users name or alias, and not the ID field since it's a relationship field and may not concatenate the text value of the ID. Not sure, you'll have to test it.
0/9000