Add Attributes for Opportunity Summary and Revenue Lines Synchronization

You can enhance and perform opportunity summary and revenue line synchronization for some attributes using Groovy scripting. Use the sample scripts in this topic to add rule definitions to the predefined opportunity cascading logic.

The rule definitions keep opportunity summary and revenue lines in synchronization with each other. Here's how to add specific attributes for opportunity summary and revenue lines synchronization:

  1. Sign in as a sales administrator or a setup user.

  2. Navigate to Application Composer.

  3. Select Sales to filter the object search.

  4. Expand Standard Objects and then expand Opportunity.

  5. Under Opportunity, click Server Scripts.

    The Server Scripts Help Request page opens.

  6. Under Validation Rules tab, select Action - Add under the Field Rules region and enter values as shown in the following example:

    Field

    Value

    Field Name

    Choose the field or attribute that you want from the drop-down list of values.

    Rule Name

    Enter a meaning full name for the rule.

    Error Message

    Enter a user-defined error message, for example, a message that warns the user the synchronization cascade has failed.

    Rule Definition

    In the script text field, cut and paste the script that you have written to validate the condition. For example, see the sections Sample Groovy Scripts for Opportunity Attributes and Sample Groovy Scripts for Opportunity Revenue Attributes in this topic for sample groovy scripts.

  7. Click Save and Close.

For a more detailed explanation of Groovy scripting using Application Composer, see the Oracle Applications Cloud Groovy Scripting Reference.

Sample Groovy Scripts for Opportunity Attributes

This table contains sample groovy script code for a subset of opportunity attributes:

Attribute

Sample Groovy Script

Close Date

cascadeInSyncValueToAllRevenues("EffectiveDate", oldValue, newValue)

return true

Status and StatusCodeSetId

Both the Status and StatusCodeSetId attributes have to be assigned together. If you decide to selectively enable synchronization cascade for Status, then you must also perform synchronization cascade for StatusCodeSetId.

// For Status def cache_name = '_statuscode_insync_cascade' 
if (oldValue == 'OPEN' && newValue == 'WON')  
{
// Only allow synchronization cascade if Status moved from OPEN to WON.    
cascadeInSyncValueToAllRevenues("StatusCode", oldValue, newValue)        

// Mark this opportunity's StatusCode as having been synchronization cascaded  
adf.userSession.userData.put(getAttribute('OptyId') + cache_name, true)
// mark this opportunity as having status just cascaded. 
}
return true

// For StatusCodeSetIddef cache_name = '_statuscode_insync_cascade'def insync_cascade = adf.userSession.userData[getAttribute('OptyId') 
+ cache_name]println("StatusCodeSetId: insync_cascade = " 
+ insync_cascade)insync_cascade = (insync_cascade == null) ? false : insync_cascade  
// ensure insync_cascade is either true/false try 

{   
if (insync_cascade)    
    {
cascadeInSyncValueToAllRevenues("StatusCodeSetId", oldValue, newValue)     
// only cascade if the Status has just been cascaded.   
    }
}
Finally
{  adf.userSession.userData.remove(getAttribute("OptyId") + cache_name)
}
return true

Win/Loss and ReasonWonLostCodeSetId

// For Win/Loss Reasondef cache_name = '_winlossreason_insync_cascade'if (oldValue == 'INSTALL_BASE' && newValue == 'TEST_VO_1') 
{   cascadeInSyncValueToAllRevenues("ReasonWonLostCode", oldValue, newValue)  
// Mark this opportunity's WinLossReason as having been synchronization cascaded   adf.userSession.userData.put(getAttribute('OptyId') 
+ cache_name, true)}return true
// For ReasonWonLostCodeSetIddef cache_name = '_winlossreason_insync_cascade'def insync_cascade = adf.userSession.userData[getAttribute('OptyId') 
+ cache_name]println("ReasonWonLostCodeSetId: insync_cascade = " 
+ insync_cascade)insync_cascade = (insync_cascade == null) ? false : insync_cascade    

// ensure insync_cascade is either true/falsetry 
{
  if (insync_cascade)
     {     cascadeInSyncValueToAllRevenues("ReasonWonLostCodeSetId", oldValue, newValue)      
     }
}finally
{  
adf.userSession.userData.remove(getAttribute("OptyId") + cache_name)
}
return true

Primary Partner

cascadeInSyncValueToAllRevenues("PrimaryPartnerId", oldValue, newValue)

return true

Primary Competitor

cascadeInSyncValueToAllRevenues("PrimaryCompetitorId", oldValue, newValue)

return true

Sample Groovy Scripts for Opportunity Revenue Attributes

Let's look at sample groovy script code for a subset of opportunity revenue attributes.

Attribute

Sample Groovy Script

Win Probability

cascadeInSyncValueToAllRevenues("WinProb", oldValue, newValue) 
return true

Sales Channel

cascadeInSyncValueToAllRevenues("SalesChannelCd", oldValue, newValue)
return true

Include Forecast

cascadeInSyncValueToAllRevenues("SalesChannelCd", oldValue, newValue)
return true