cancel
Showing results for 
Search instead for 
Did you mean: 

Modify values from a custom value list (drop-down) at runtime

isaac_ariza_cruz
Participant
0 Kudos

Hi all,

I'm trying to implement the following requirement to include a new extension definition to be used into Projects. This extension will be a value list which will display a set of values which will be used during the approval flow. Furthermore, these values need to be modified at runtime depending on actions of the current approval.

Due to I'm new in SAP Sourcing, could you please let me know if this functionality could it be implemented? I've been reviewing some documents regarding this topic and I've not found anything to modify at runtime values displayed on a value list. So could you please let me know if it is possible or indicate me any kind of documentation to check it?

Thanks and best regards,

Isaac

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Isaac,

Use below code to modify valuelist value at runtime.

valueTypeHome=IBeanHomeLocator.lookup(session,ValueListTypeIBeanHomeIfc.sHOME_NAME);

valueTypeBean=valueTypeHome.findByExternalId("vl.Contract_document_type"); //Check valuelist internal name and enter here

valueBean=valueTypeBean.getCollnValueListValue().get(2); //select a particular value from list , first value in list is at index 0

doc.getExtensionField("CONTRACT_DOC_TYPE").set(valueBean.getLocalizedObjectReference()); //Give Value list Extension field name here

Try this.

Regards,

Saloni

Former Member
0 Kudos

Hi,

Add below import as well...

import com.frictionless.api.doccommon.masterdata.ValueListValueIBeanIfc.*;

Regards,

Saloni

isaac_ariza_cruz
Participant
0 Kudos

Hi Saloni,

Thanks a lot for your quick answer. Just one question: where do I have to put that code? As far as I know and due to these values have to be updated during the approval flow, I was thinking to use it as part of the workflow steps (as a script inside the workflow logic created using Together Workflow Editor). Is it correct or should I use this code included as a "script definition" ?

Thanks again and best regards.

Former Member
0 Kudos

Hi,

Write this code in Script of type "Document Lifecycle Event" and using class for which you want to validate the approval process(like project/master agreeement/contract documnet..) and use Target as Validated

Please grant correct answer point if it works...

Thanks,

Saloni

isaac_ariza_cruz
Participant
0 Kudos

Hi,

Thanks for the answer and the support. I will test it and let you know the results.

Thanks again and regards,

Isaac

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi guys,

the code above only seems to take a value from the list and paste it into another custom text field. Is this correct?

I was wondering if it is possible to remove values from the value list during runtime.

e.g. You define a value list with 3 values. During runtime you perform some checks and based on that you only show 2 values. In another case, you only show one value.

Anyone ever had any succes implementing this kind of functionality?

Thanks,

Bram