Task: Autopopulate the Primary Contact when Account is selected and viceversa (Doc ID 2264391.1)

Last updated on MAY 19, 2017

Applies to:

Oracle Fusion Sales Cloud Service - Version 11.12.1.0.0 and later
Information in this document applies to any platform.

Symptoms

On : 11.12.1.0.0 version, Activity Management

Customer has the following issue. On Activity object they have the following script added as a Before Insert:


if(AccountId)
{

def vo = newView('OrganizationProfile')
def vc = newViewCriteria(vo)
def vcr = vc.createRow()
def vci = vcr.ensureCriteriaItem('PartyId')
vci.setOperator('=')
vci.setValue(AccountId)
vc.insertRow(vcr)
vo.appendViewCriteria(vc)
vo.executeQuery()
//fetch the account details
def account=vo.first()
def primaryContactId=account?.PreferredContactPersonId


def src=ActivityContact.createRow();
src.setAttribute('ContactId',primaryContactId)
ActivityContact.insertRow(src)

setAttribute('PrimaryContactId',primaryContactId)
}


They are using this script for the following: whenever a task is created and an Account is added, then the Primary Contact of the account should be automatically populated;

This is not working for them when the account has no Primary Contact. In this scenario, when attempting to creating task, the following error occurs.

ERROR
-----------------------
Attribute ContactId in ActivityContactEO is required;

 

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

Script purpose/requirement

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

In the Create task layout, whenever a task is created and the Account selected from the DCL, customer wants the Primary Contact of account to be auto-populated. Same goes the other way around (Primary Contact selected, Account to be auto-populated).

STEPS
-----------------------
The issue can be reproduced at will with the following steps:
1. SUI -> Activities -> Task -> Create Task

BUSINESS IMPACT
-----------------------
The issue has the following business impact:
Due to this issue, users cannot create task, when script is added.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms