You need to sign in to do that
Don't have an account?
Stavros McGillicuddy
Syntax to declare integer
I have to believe my syntax is not correct. Maybe I'm declaring everything as string rather than integer?
Sample_Name__c is a text field
Sample_Quantity__c is a numeric field
Sample_Price__c is a currency field
When I change all of the field types to text this code executes as expected but fails when the fields are set to numeric and currecy.
What edit to my code do I need to make?
Sample_Name__c is a text field
Sample_Quantity__c is a numeric field
Sample_Price__c is a currency field
When I change all of the field types to text this code executes as expected but fails when the fields are set to numeric and currecy.
What edit to my code do I need to make?
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/32.0/apex.js")} var record = new sforce.SObject("Opportunity"); record.Id = '{!Opportunity.Id}'; //copy opportunity line items result = sforce.connection.query("Select PricebookEntry.Product2.Name, Quantity, TotalPrice From OpportunityLineItem WHERE OpportunityId = '{!Opportunity.Id}' and (NOT Name like '%Discount%')"); records = result.getArray("records"); var strProductNames = ''; var strProductQuantity = ''; var strProductPrice = ''; for(var i=0; i<records.length ; i++){ strProductNames = records[i].PricebookEntry.Product2.Name strProductQuantity = records[i].Quantity strProductPrice = records[i].TotalPrice; } if(strProductNames.length>0){ strProductNames = strProductNames.substring(0,strProductNames.length-2); } record.Sample_Name__c = strProductNames; record.Sample_Quantity__c = [i].strProductQuantity; record.Sample_Price__c = strProductPrice; sforce.connection.update([record]); window.location.reload();
Best Answer chosen by Stavros McGillicuddy
Stavros McGillicuddy
I found it... This runs as expected