0

I have 4 fields (project_id, domain_name, link_log, url) in unique key in my local database for store unique data,

data like -

project_id(int)--> 1224; domain_name (varchar)--> 'javatpoint.com'; link_log (int)--> 0 or 1; url (varchar)--> 'http://www.javatpoint.com/spring-tutorial-dependency-injection-by-setter-method'

according to sql the unique show like.. "1224-javatpoint.com-0-http://www.javatpoint.com/spring-tutorial-dependency-injection-by-setter-method"

i want same unique key in salesforce.

4
  • so you can easily create unique fields in salesforce. just click a checkbox. Jul 21, 2016 at 6:16
  • i want a combination of all 4 field in unique key (project_id-domain_name-link_log-url) according your comment every field make a unique individually (single filed) ,
    – Prade jo
    Jul 21, 2016 at 6:39
  • then you can make a formula field but to make it unique you need to handle that in trigger. Jul 21, 2016 at 7:21
  • 1
    @TusharSharma You definitely do not need trigger. Workflow, Process Builder, etc. are perfectly sufficient.
    – Adrian Larson
    Jul 21, 2016 at 13:35

1 Answer 1

2
  • create a formula field A and use formula domain__c +"-"+ text(linkLog__c)+"-"+ text(projectid__c )+"-"+ url__c (text use for convert number to text)
  • create a workflow (field update) and store data in new filed B (Unique Case Insensitive)
2
  • 2
    While I wouldn't create the field A, the concept is something I'd highly recommend. You'd want to store the value in a field rather than a formula in a field. You can then make that field indexable (External ID), unique, and a SOQL query will run a lot better.
    – Nick C
    Jul 21, 2016 at 12:55
  • thanks @NickCook for your valuable suggestion ; i used only workflow (field update) to create unique key .
    – Prade jo
    Jul 22, 2016 at 10:02

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