Vous êtes sur la page 1sur 4

Groovy script:

Return in Layout:

def a = getAttribute('LeaseStatus_c');

if('TERMINATED' == a || a == 'CANCELLED BOOKING'){

return true;

---------------------------------------------------

True or false in updatable field ( readable):

if("BOOKED" == LeaseStatus_c){

return false;

else{

return true;

***********************************************************************************

def a = getAttribute('LeaseStatus_c');

if('BOOKED' == a){

return false;

*********

def a = getAttribute('LeaseStatus_c');

if("BOOKED" == a){

return false;

else{

return true;

----------------------------------------------------

To set a value:

def a = getAttribute('LeaseStatus_c');
setAttribute('LSName_c',a)

----------------------------------------------------

Field trigger in server script:

def a = getAttribute('LeaseEndDate1_c');

def b = getAttribute('LeaseStartDate_c');

if (a <= b)

throw new oracle.jbo.ValidationException ("EnterValidEndDate");

How to update a field in the parent object with the sum of a field all the child objects - Groovy Script (Doc ID 2042235.1)

Create a field trigger in the child object for the specific field.

The code is as following. Take in attention that the object Account and Activity was used as example. The specific references to each object will
have to be updated accordingly.

def voProject = newView('Activity')


def vc = newViewCriteria(voProject)
def vcr = vc.createRow()
def vci = vcr.ensureCriteriaItem('AccountId')
vci.setOperator('=')
vci.setValue(AccountId)
vc.insertRow(vcr)
voProject.appendViewCriteria(vc)
voProject.executeQuery()

def iSum=0;
def sCur;
def oProject;

while (voProject.hasNext())
{
oProject=voProject.next();
sCur = oProject.getAttribute('OscCurrency_c');
if(sCur!=null){
iSum=iSum+sCur.floatValue();
}
}

def voMasterProject = newView('OrganizationProfile')


vc = newViewCriteria(voMasterProject)
vcr = vc.createRow()
vci = vcr.ensureCriteriaItem('PartyId')
vci.setOperator('=')
vci.setValue(AccountId)
vc.insertRow(vcr)
voMasterProject.appendViewCriteria(vc)
voMasterProject.executeQuery()

def oMasterProject=voMasterProject.next();

oMasterProject.setAttribute('OscCurrency1_c', iSum);

PaymentCollection_c
---------------------------------

to pull a field value from One Custom Object To another using groovy (Doc ID 2128435.1)

def salesordernumber = Num_t_c;


def vo = newView('Useit_c')
def vc = newViewCriteria(vo)
def vcr = vc.createRow()
def vci1 = vcr.ensureCriteriaItem('Id')
vci1.setOperator('=')
vci1.setValue(Dcl_t_Obj_c.Id)
vc.insertRow(vcr)
vo.appendViewCriteria(vc)
vo.executeQuery()
def role
if (vo.hasNext()) {
def row = vo.next()
row.setAttribute('Num_u_c',salesordernumber)
}

https://ucf1-zfgp-fa-
ext.oracledemos.com/customer/faces/CrmFusionHome?cardToOpen=MOO_OPPTYMGMTOPPORTUNITIES_CRM_CARD&tabToOpen=MOO_OP
PTYMGMTOPPORTUNITIES_CRM&TF_subTabName=Summary&TF_skipToEditOptyId=300000076535932

https://hostename:port/customer/faces/CrmFusionHome?cardToOpen=MOO_OPPTYMGMTOPPORTUNITIES_CRM_CARD&tabToOpen=MOO_
OPPTYMGMTOPPORTUNITIES_CRM&TF_subTabName=Summary&TF_skipToEditOptyId=[

Vous aimerez peut-être aussi