cancel
Showing results for 
Search instead for 
Did you mean: 

How to obtain Supplier Number & Supplier Name from the Agreement.

ritikbaral
Explorer
0 Kudos

Hi Sourcing Gurus,

How can we(Code to) obtain the Supplier Number & Supplier Name from a Master Agreement or Agreement. I need these details in Script definition while saving the Master Agreement/Agreement or while changing the Supplier Contact which is under Supplier Info tab.

Thanks,

Ritik

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ritik,

Try this code

supplierContactNumber=doc.getVendorAcctNum();

vendorName = doc.getFieldMetadata("VENDOR").get(doc).getDisplayName(session);

Regards,

Uday

ritikbaral
Explorer
0 Kudos

Hi Uday,

Thanks a lot for your prompt reply. Appreciate your help.

The code given above will pull the Vendor name based upon Vendor field. But the Vendor field is not there on the Agreement/Master Agreement.We need to fetch the vendor based on the Supplier Contact.

Thanks,

Ritik

Former Member
0 Kudos

Hi Ritik,

Once you populate the supplier primary contact and click on done and open the MA again . you will see the supplier primary contact field changing to supplier primary contact in Vendor. The vendor that get displayed  there is the vendor field. So its already pulled by Supplier contact itself.Just verify and let me know if u face issue.

Regards,

uday

ritikbaral
Explorer
0 Kudos

Hi Uday,

Sorry i was in transit, so could not reply in time . Thanks a lot for your help Uday.

I tried the code that you sent. To confirm whether the Code is pulling the correct Vendor Number and Name , what i am trying to do is , after getting the Vendor Number  through the code

supplierContactNumber=doc.getVendorAcctNum();

I am trying to set this value in Supplier Primary Contact Number field through code

doc.setVendorAcctNum(supplierContactNumber);

But for some reason the value is not coming in Supplier Primary Contact Number field. I tried to hard code the value, but still its not showing.

Any idea , why i am facing this issue.

Thanks,

Ritik

ritikbaral
Explorer
0 Kudos

Hi Uday,

I checked this , the problem was with the Scripting Context Field Data Edit. It seems there is some bug with Field Data Edit. When I tried the same with Document Life Cycle Event, it worked. The only issue left is its not pulling the Vendor Number. The vendor number is coming blank.

When i am going to a Supplier i can see a supplier ID, is the supplier ID is the Vendor Number?

P.S. -  Just want to confirm , is following is the right way to set a value to a custom extension

doc.getExtensionField(EXTENSION_NAME).set(value);

Thanks again for your help,

Ritik

Former Member
0 Kudos

Hi Ritik,

Did you try to bring the document in Edit mode by scripting and then set your value and save it.

I am assuming by vendor Number you mean vendor contact number.

By Supplier ID you mean the External Id in the Header section of Supplier?.

Regards,

Uday

ritikbaral
Explorer
0 Kudos

Hi Uday,

Thanks Uday for your constant help on this issue.

I assume when you try to set any value on the Custom Extension field , the document will be automatically go in edit mode.

In my case Supplier ID is nothing but the Supplier Number. This is the Supplier Number which gets generated when you create a Supplier in eSourcing or the Supplier Number that we import from ECC.

Thanks,

Ritik

Answers (0)