• Martin Vyskocil
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
Hey folks,

I've just started with JS and need a little bit of help..
Need to write a condition evaluating Opportunity Close Date for monthly fields.
Ie.
for Jan:  IF Jan-15-2015 > CloseDate  THEN {!Opportunity.Revenue__c} ELSE null
for Feb:  IF Feb-15-2015 > CloseDate THEN {!Opportunity.Revenue__c} ELSE null
and so on till Dec

Could you please advise what is wrong with the code below?
---------------------------
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 

var c = new sforce.SObject("IYNB__c"); 
c.id = "{!IYNB__c.Id}"; 
c.Jan_FC__c = IF(DATE(year(Opportunity.CloseDate),1,15) > DATE(year(Opportunity.CloseDate),month(Opportunity.CloseDate),day(Opportunity.CloseDate)) {'{!Opportunity.Revenue__c}'}
else {null};
c.Feb_FC__c = IF(DATE(year(Opportunity.CloseDate),2,15) > DATE(year(Opportunity.CloseDate),month(Opportunity.CloseDate),day(Opportunity.CloseDate)) {'{!Opportunity.Revenue__c}'} 
else {null};

result = sforce.connection.update([c]); 
window.location.reload()
----------------------------------
Thanks in advance,
Martin
Trailhead Lesson reference: https://trailhead.salesforce.com/projects/quickstart-lightning-experience-sales/steps/qs-lex-sales-4
The lesson is a carryover from a prior lesson: https://trailhead.salesforce.com/projects/quickstart-lightning-experience-sales/steps/qs-lex-sales-3

therefore the source of the record created came from the qs-lex-sales-3. I found that when I tried to submit for challenge I get the following error:
Challenge Not yet complete... here's what's wrong: 
The record was not created correctly.


This does not make sense when the prior record was created by prior lesson and now has a problem to complete the existing? The instructions show the following update to the record name: 10,000 Units (Opportunity)

1. Amount from 100,000 to 120,000
2  Close date. (to present date).
3. Stage from 10 prospecting to 100% -Closed/Won.
opportunity from close your deal exercise
Appreciate feedback.
Thanks, Fred Flores 
Hey folks,

I've just started with JS and need a little bit of help..
Need to write a condition evaluating Opportunity Close Date for monthly fields.
Ie.
for Jan:  IF Jan-15-2015 > CloseDate  THEN {!Opportunity.Revenue__c} ELSE null
for Feb:  IF Feb-15-2015 > CloseDate THEN {!Opportunity.Revenue__c} ELSE null
and so on till Dec

Could you please advise what is wrong with the code below?
---------------------------
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 

var c = new sforce.SObject("IYNB__c"); 
c.id = "{!IYNB__c.Id}"; 
c.Jan_FC__c = IF(DATE(year(Opportunity.CloseDate),1,15) > DATE(year(Opportunity.CloseDate),month(Opportunity.CloseDate),day(Opportunity.CloseDate)) {'{!Opportunity.Revenue__c}'}
else {null};
c.Feb_FC__c = IF(DATE(year(Opportunity.CloseDate),2,15) > DATE(year(Opportunity.CloseDate),month(Opportunity.CloseDate),day(Opportunity.CloseDate)) {'{!Opportunity.Revenue__c}'} 
else {null};

result = sforce.connection.update([c]); 
window.location.reload()
----------------------------------
Thanks in advance,
Martin
Has anyone had any experience passing the Account Name through to Wikipedia from a custom link?  Currently, Wikipedia is adding a + between the words of the Account Name and throwing off the search.  Thanks.
  • March 16, 2007
  • Like
  • 0