cancel
Showing results for 
Search instead for 
Did you mean: 

How can I add custom script to Supplier Registration approval?

Former Member
0 Kudos

I need to add some custom logic to replace the primary contact's User ID when a supplier registration record is approved. I am not able to figure out where exactly to write this script..Class no 607 - Supplier (masterdata.Vendor) or Class no 1606 Supplier (services.ServicesVendor) or Class No 147 Supplier Registration (vendormgmt.vendor_registration)?

When a supplier enters details in the supplier registration form, the only details regarding Contact are first name, last name and email. But when the same record comes up in Esourcing for the buyer's approval, and gets approved, I can see the Primary Contact is created with a system-generated user id. I want to supply my own user id instead of this.. so where should I write the custom script? Please help in identifying correct Class and Target.

TIA

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Gayathri

Generally in supplier registration forms suppliers are asked to accept the terms and conditions and then submit on save. Is this the case with you? what i mean to say is, since registration form is sell-side view of supplier class, is there a field in registration form (custom field) which will only get filled when submitting the registration form and not when buyer create a supplier via workflow , if yes, you might be able to identify between two processes.

Regards

Former Member
0 Kudos

Hi Dhiraj,

Thanks for that idea.. we don't have any terms n conditions field. There is one field for attachments - Field name :

W-8 / W-9 / GTM Attachment:

Attach applicable business certifications or other relevant information files

But I couldn't figure out to which field in Supplier field it is mapped to. Not sure if this is a standard field or custom. Can you please help?

Former Member
0 Kudos

Just found out that was an extension field.. am now able to differentiate between the 2 flows using the file size of this custom attachment field

Answers (1)

Answers (1)

Former Member
0 Kudos

When the buyer approves a Supplier Registration record, the Create New Supplier screen is displayed with information from the registration page. The primary contact details are also populated in this way. When the buyer clicks Save, the supplier gets created.

So the script ideally should be a pre-save script on Supplier (class 607). Now the problem is how do we identify whether this New Supplier screen was reached through registration approval flow or Create new supplier flow? I need to add the custom logic for registration approval flow only.. any pointers?

Former Member
0 Kudos

I haven't worked on this scenario before but I am guessing you might be able to use doc.getParentIBean() method to check if the supplier is created independently or as a follow on to another process. In case there is an alternate better way it would be great if you let us know as well.

Thanks,

Arijeet

Former Member
0 Kudos

Thanks for the suggestion Arijeet.. but doc.getParentIBean() is null in both cases

I have implemented this currently in a roundabout way. My requirement is to replace the user id of the primary contact with another value in case the supplier is created through Registration Approval flow. (In case of new supplier/new contact I already have a script in place to replace the user id whenever the Contact record is validated).

In this case, I am writing a script on Supplier - Validate. If doc.isObjectAccessModeNew() is true, I check the size of the list doc.getCollnContact(). If the size is 1, I am assuming it is a New Supplier created through Registration Approval (since the registration form requires primary contact details to be filled).. the same script will get called if some goes to Suppliers - Create Supplier and add just one contact record and Save.. but can't help it as of now..

If anyone has any other solutions, please share..