• DanLTran
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

I have a custom list button on my org with checkboxes enabled. Users should be able to select one record from a related list and click the button, when they do it updates a field (Generate_Follow_Up__c) from False to True which in turn drives a workflow rule.

When the button is clicked it should apply a few criteria before taking any action:

1 - at least one record selected

2 - no more than 1 record selected

3 - Record type of record selected must not be x - with x being one of the Record types in my org.

 

I have the number of records validation down but cannot get the Record Type to work, it either blocks all or allows all. Any suggestions would be fantastic - thanks so much

Dan

 

{!REQUIRESCRIPT ("/soap/ajax/13.0/connection.js")} var records = {!GETRECORDIDS($ObjectType.Comparison_Survey__c)}; var newRecords = [];

if (records[0] == null) { alert("Please select at least one survey from which to generate your follow up") }

else

if (records[1] != null) { alert("Please select only one survey from which to generate your follow up") }

else { for (var n=0; n<records.length; n++) { var c = new sforce.SObject("Comparison_Survey__c"); c.id = records[n]; c.Generate_Follow_Up__c = true; newRecords.push(c); } result = sforce.connection.update(newRecords); window.location.reload(); }

I have a custom object - Case Management, when the Contact lookup field is entered I want the Account lookup field associated with that Contact to be automatically entered.  I am new at this so here's what I have,  

Case_Management__c (before insert, before update) { for(Case_Management__c co: Trigger.new){ if (co.Contact__c != null){ co.Account__c = 'Yes'; } } }

 

This needs to be edited, but I am lost.