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)
}
//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)
}
No comments:
Post a Comment