Saturday, 28 November 2015

Oracle Sales Cloud - GROOVY SCRIPT - Currency format

IMPLEMENTATION OF NUMBERFORMAT GROOVY SCRIPT:
Initially a temporary variable gets the value of the field that needs to be formatted. Assuming the current value is in the string format, the length of the value is calculated based on the decimal.
def tempValue = c_Value //e.g. $USD 9967644.09
def currentIndex = tempValue.indexOf('.')
def currencyValue
if(currentIndex<0)
currencyValue = tempValue
else
{
currencyValue =tempValue.substring(0,currentIndex)
}
def currencyLength = currencyValue.length()

After 3 digit formatting, the obtained values are added into a list.
def temp=0
def emptyList = []
if(currencyLength%3 !=0)
temp = currencyLength%3
if(temp!=0 && temp<=currencyLength ){
emptyList.add(currencyValue.substring(0,temp))
}
else
{
emptyList.add(currencyValue.substring(0,temp+3))
temp=temp+3
}
while(temp<currencyLength)
{
emptyList.add(currencyValue.substring(temp,temp+3))
temp=temp+3
}
  • Finally all the values in the list are concatenated as comma separated string and returned as desired US currency format.
String finalCurrency = ""
int i
for(i=0;i<emptyList.size();i++)
{
finalCurrency+=emptyList[i]+','
}
return "\$"+finalCurrency.substring(0,finalCurrency.length()-1) //e.g. $9,967,644
The above code is defined as a global function formatCurrency which could be referred in the text formula field as below,
def currencyValue = OptyRevenue_c
def tempValue = currencyValue.toString()
def finalCurrency=adf.util.formatCurrency(tempValue)//has the formatted value

Oracle Sales Cloud - Creating Appointment - Sample Code

scenario:
when an Opportunity is modified e.g Field “Next Contact Date”  An appointment is created to schedule a meetings:
if (isAttributeChanged(‘NextContactDate_c’))
{
//define variables
def voAppointment = newView(‘AppointmentVO’)
def createAppt = voAppointment.createRow()
def currentDateTime = now()
def apptName = ‘TestGroovyScript’ + currentDateTime
//set the required values to a variable
createAppt.setAttribute(‘ActivityName’, apptName)
createAppt.setAttribute(‘SourceObjectId’,OptyId )
createAppt.setAttribute(‘SourceObjectCd’,’OPPORTUNITY’)
//insert a record in Appointment
voAppointment.insertRow(createAppt)
}

Friday, 27 November 2015

Oracle Sales Cloud - Enable Notifications

The following steps are required to enable notifications in Oracle Sales Cloud R10:

Enable Administrator Profile Values:

All Tasks > Manage Administrator Profile Values 

ZMM_ACTIVITY_DISABLE_EMAIL_APPT_NOTIF = No 
ZMM_ACTIVITY_DISABLE_EMAIL_TASK_NOTIF = No 
ZMM_ACTIVITY_TASK_NOTIF_EMAIL= Yes 
ZMM_ACTIVITY_APPT_NOTIF_EMAIL = Yes 
ZMM_ACTIVITY_EXTERNAL_NOTIFICATION = Yes


Please follow the steps bellow to enable the notification reminders for a user: 

-In the UI click the user name (aka first user) in the right top corner 
-Click Set Preferences... 
-Click Calendar and Appointment Preferences 
-On the Task section 'Notify me if changes are made by others' select the desired options (for example enable 'When I am the owner') 
-On the Task section 'Notify me by' select the the option 'Notification list' 
-Save and logout 
-Login in with another user 
-Create activity and set the owner to the first user 
-Logout and login with the first user 
-Verify that you will have a notification