• Pamela DuPont
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
Good morning,

I have a custom button that I can't seem to get to work. I'm very much a novice at writing code so I'm sure something is written incorrectly and I'm just not seeing it.

My custom button allows the user to submit the Case they created for review. However, they need to have a related Crop (custom related object) associated with that Case before it can be reviewed. There is a roll-up summary field on the Case called Crop_Record_Count__c that counts the number of Crop records associated. There needs to be at least 1 associated before the Case can be submitted for review.

Any ideas where I went wrong with the code?


{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}


/* Checks to make sure there is an associated Crop.
If TRUE, update the status and send for review.
If FALSE, provide an alert to fill add a Crop to the Case. */
function UpdateandValidate(){
var Crop = "{!Case.Crop_Record_Count__c}";
if(Crop != "0");
{
var objCase = new sforce.SObject('Case');
objCase.Id = '{!Case.Id}';
objCase.Review_Status__c = 'Submitted for Review by Rep';
var result = sforce.connection.update([objCase]);
alert('This case has been sent for review.');
document.location.href="/{!Case.Id}";
}
else {
msgAlert = "Please add a Crop before sending Case for review";
alert(msgAlert);
}
}


Thanks in advance!
Hi!

I have a validation rule that is doing what it is supposed to be doing however I know it is not written in the most efficient way. Does anyone have any suggestions on how to streamline the code? I'm new to writing more complex rules so am not quite sure how to go about it. Any help or suggestions would be wonderful. Thanks!

AND(
Product__r.ProductCode <> "36726",
Product__r.ProductCode <> "40631",
Product__r.ProductCode <> "36724",
Product__r.ProductCode <> "36722",
Product__r.ProductCode <> "41518",
Product__r.ProductCode <> "42662",
Product__r.ProductCode <> "34482",
Product__r.ProductCode <> "33207",
Product__r.ProductCode <> "33208",
Product__r.ProductCode <> "33206",
Product__r.ProductCode <> "25723",
Product__r.ProductCode <> "54359",
Product__r.ProductCode <> "54361",
Product__r.ProductCode <> "54358",
Product__r.ProductCode <> "54357",
Product__r.ProductCode <> "21335",
Product__r.ProductCode <> "74350",
Product__r.ProductCode <> "74348",
Product__r.ProductCode <> "35214",
Product__r.ProductCode <> "17958",
Product__r.ProductCode <> "42891",
Product__r.ProductCode <> "39283",
Product__r.ProductCode <> "42890"
)
&&
CU_Code__c="A352"
&&
RecordType.DeveloperName="CP_Product_Performance_Assurance"
&&
Assurance_Issue__c=TRUE
||
AND(
Product__r.ProductCode <> "48120",
Product__r.ProductCode <> "48121",
Product__r.ProductCode <> "53916"
)
&&
CU_Code__c="A362"
&&
RecordType.DeveloperName="CP_Product_Performance_Assurance"
&&
Assurance_Issue__c=TRUE
Hi!

I need help writing a trigger. I'm very new to Apex and am not quite sure where to begin with this one. Here is the scenario:

I have a date field on the Account object (Bulk_Ending_Inventory_Form_Date_Sent__c) that gets auto-populated by Conga when a form is merged. Once that field is populated, I need a one-time insert to a field (Date_Sent_for_Signature__c) on all child records for related custom object (Bulk_Ending_Inventory__c) if Date_Sent_for_Signature__c is blank. I would use a workflow for this but there will be no edits on the child object records to initiate the workflow.

Once that field (Date_Sent_for_Signature__c) is populated, I have a workflow that clears the date field (Bulk_Ending_Inventory_Form_Date_Sent__c) on the Account object so it will be ready for the next time Conga merge happens.

I hope this makes sense! Any help would be greatly appreciated. :-)
Good morning,

I have a custom button that I can't seem to get to work. I'm very much a novice at writing code so I'm sure something is written incorrectly and I'm just not seeing it.

My custom button allows the user to submit the Case they created for review. However, they need to have a related Crop (custom related object) associated with that Case before it can be reviewed. There is a roll-up summary field on the Case called Crop_Record_Count__c that counts the number of Crop records associated. There needs to be at least 1 associated before the Case can be submitted for review.

Any ideas where I went wrong with the code?


{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}


/* Checks to make sure there is an associated Crop.
If TRUE, update the status and send for review.
If FALSE, provide an alert to fill add a Crop to the Case. */
function UpdateandValidate(){
var Crop = "{!Case.Crop_Record_Count__c}";
if(Crop != "0");
{
var objCase = new sforce.SObject('Case');
objCase.Id = '{!Case.Id}';
objCase.Review_Status__c = 'Submitted for Review by Rep';
var result = sforce.connection.update([objCase]);
alert('This case has been sent for review.');
document.location.href="/{!Case.Id}";
}
else {
msgAlert = "Please add a Crop before sending Case for review";
alert(msgAlert);
}
}


Thanks in advance!