cancel
Showing results for 
Search instead for 
Did you mean: 

Script to add suppliers in project document

Former Member
0 Kudos

Hello Experts ,

We are currently running on SAP Sourcing /CLM 10 . We are using project module with supplier tab .  Currently have a requirement for adding the supplier(s) in supplier tab of project via script ( instead of adding manually , needs to be added via script while saving the project  )  . The code we are trying is below but not working .

While saving the project document no error is appearing but supplier is also not appearing under supplier tab . Can you please guide ?

supplierContactColl = doc.getVendorList();

StandardVendor=doc.getVendorList().create();

StandardVendor.setUniqueName("VEN-0000002");

StandardVendor.setDisplayName("ABC Ltd");

StandardVendor.setContactEmail("seraka@xx.com");

The code is triggered on Project document and saving event .

Here , we wanted to hard code a supplier to be added in supplier tab . The supplier is existing  in CLM . Once we have the above code working , we need to add supplier dynamically on saving event .

Accepted Solutions (0)

Answers (1)

Answers (1)

kushagra_agrawal
Active Participant
0 Kudos

Hi Sudipta,

It is not recommended to set the values in POST_SAVE Event, changes will not reflect to the opened document. Moreover this event occurs when all the vaidation is done and doc is saved in the DB.  Try to move your code to Validate event script and check. It should work.

Hope it helps!

Best,

Kushagra A

Former Member
0 Kudos

Thanks for the reply Kushagra.

I have tried the same for validated target , but no result . Is there anything I am missing in the code ?

Thanks in advance

former_member190023
Contributor
0 Kudos

Make sure you also have:

supplierContactColl.add(StandardVendor);

to add the newly created line to the collection.

Bogdan

kushagra_agrawal
Active Participant
0 Kudos

Hi Sudipta,

Please see the below code:

supplierContactColl = doc.getVendorList();

StandardVendor=supplierContactColl .create();

StandardVendor.setUniqueName("VEN-0000002");

StandardVendor.setDisplayName("ABC Ltd");

StandardVendor.setContactEmail("seraka@xx.com");

supplierContactColl .add(StandardVendor);

Hope it helps!

Best,

Kushagra A