Thank you for supporting the Cloud Customer Connect Community in 2024. It's a gift to work with you!

Look back
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Remove Inactive Users from Opportunity Team tab using groovy

in Sales 1 comment

Summary: Remove Inactive Users from Opportunity Team tab using groovy

Hi Team,

We wrote below script to remove Inactive Users from Opportunity Team tab using groovy. But it is not working as expected.

Can anyone help us here.

def OpptyResourcesIterator = nvl(OpportunityResource, null);

while(OpptyResourcesIterator.hasNext())

{

def OpptyResourcesVORow = OpptyResourcesIterator.next();

Long existingResourceId = OpptyResourcesVORow.getAttribute('ResourceId');

def resources = newView('Resource')

def vc = newViewCriteria(resources)

def vcr = vc.createRow()

def vci1 = vcr.ensureCriteriaItem('PartyId')

vci1.setOperator('=')

vci1.setValue(existingResourceId)

vc.insertRow(vcr)

resources.appendViewCriteria(vc)

resources.executeQuery()

while(resources.hasNext())

{

def row = resources.next();

def ActiveFlag = row.getAttribute('UserAccountActiveFlag')

if(ActiveFlag == 'N'){

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!