How can i pass a string to a Service URL that is defined field type "Webservice Object Referencing"
Asked by Stuart Wosika:

Hi guys,

<https://wiki.vertuna.com/display/CONFIFORMS/Using+Webservice+Object+Referencing+Field> is an excellent example of how to get at fields in Jira JSON using Webservice Object Referencing field type where you entry the issue id directly into the field

BUT

how can I pass another field type (instead of entry.jiraRef), such as a value set for a "Text" field into the Service URL?

I have tried different Virtual functions to transform the text value i.e. entry.transform(my_field) etc. but this does not seem to be something that the WOR field recognises.

Can you help with this please?

BR.

Stuart.


Answers:
author: Alex Medved _ConfiForms_
body: Hi [@Stuart Wosika](/t5/user/viewprofilepage/user-id/5235433)

The idea of this field is that the value in the field **itself** should be used as an argument for the web-service call

Alex

comments: author: Stuart Wosika
body: I understand that but I see this would have limited value. I would expect that would pass a value from a lookup or another webservice call for example. Was just trying to understand if could do this and jf so, how would make this value compatible.


author: Alex Medved _ConfiForms_
body: Then you just set this field to a value you have looked up or obtained elsewhere

Alex


author: Stuart Wosika
body: I tried this with fields such as Text and did not pass the value. I thought I would need a Virtual function to do conversion but could not get that to work as well.

comments: author: Alex Medved _ConfiForms_
body: Not sure what you mean... could you share an example?


author: Stuart Wosika
body: \<h1\>Form\</h1\>  
\<ac:structured-macro ac:macro-id="8513c626-244c-4d2f-a1c6-20fbfce5b366" ac:name="confiform" ac:schema-version="1"\>  
\<ac:parameter ac:name="formName"\>myform\</ac:parameter\>  
\<ac:rich-text-body\>  
\<ac:structured-macro ac:macro-id="a45b4f9c-fe1b-44ae-a948-15cd7cbd69d1" ac:name="confiform-entry-register" ac:schema-version="1"\>  
\<ac:parameter ac:name="type"\>Embedded\</ac:parameter\>  
\<ac:parameter ac:name="atlassian-macro-output-type"\>INLINE\</ac:parameter\>  
\<ac:rich-text-body\>  
\<p\>  
\<br/\>  
\</p\>  
\</ac:rich-text-body\>  
\</ac:structured-macro\>  
\<p\>  
\<ac:structured-macro ac:macro-id="f5f3510e-65d3-471d-a37e-7d6f46782aa9" ac:name="confiform-field-definition" ac:schema-version="1"\>  
\<ac:parameter ac:name="fieldName"\>Keys\</ac:parameter\>  
\<ac:parameter ac:name="fieldLabel"\>Keys\</ac:parameter\>  
\<ac:parameter ac:name="type"\>text\</ac:parameter\>  
\</ac:structured-macro\>  
\</p\>  
\<p\>  
\<ac:structured-macro ac:macro-id="6d8df9eb-7c86-4497-a57e-901312769aa7" ac:name="confiform-field-definition" ac:schema-version="1"\>  
\<ac:parameter ac:name="mapping"\>\|key\|undefined\</ac:parameter\>  
\<ac:parameter ac:name="fieldName"\>jiraRef2\</ac:parameter\>  
\<ac:parameter ac:name="fieldLabel"\>Jira issue reference\</ac:parameter\>  
\<ac:parameter ac:name="values"\>/rest/api/2/issue/\[entry.Keys\]\</ac:parameter\>  
\<ac:parameter ac:name="extras"\>c2913ec595525a5f89dd9cd89e54cd94\</ac:parameter\>  
\<ac:parameter ac:name="type"\>objectRef\</ac:parameter\>  
\</ac:structured-macro\>  
\</p\>  
\<p\>  
\<br/\>  
\</p\>  
\<p\>  
\<br/\>  
\</p\>  
\</ac:rich-text-body\>  
\</ac:structured-macro\>  
\<h1\>Table\</h1\>  
\<ac:structured-macro ac:macro-id="2d84b892-01fa-4aa2-b809-bab871188810" ac:name="confiform-table" ac:schema-version="1"\>  
\<ac:parameter ac:name="formName"\>myform\</ac:parameter\>  
\<ac:rich-text-body\>  
\<p\>  
\<ac:structured-macro ac:macro-id="1e4a2c13-de5d-483f-a9b7-5e4c93ed1cb0" ac:name="confiform-field" ac:schema-version="1"\>  
\<ac:parameter ac:name="fieldName"\>jiraRef2\</ac:parameter\>  
\</ac:structured-macro\>  
\</p\>  
\<p\>  
\<ac:structured-macro ac:macro-id="570382d6-a296-4408-9abc-b4cf0996beb3" ac:name="confiform-field" ac:schema-version="1"\>  
\<ac:parameter ac:name="overrideLabel"\>Jira issue type description\</ac:parameter\>  
\<ac:parameter ac:name="fieldName"\>jiraRef2.fields.issuetype.description\</ac:parameter\>  
\</ac:structured-macro\>  
\</p\>  
\<p\>  
\<ac:structured-macro ac:macro-id="c199bfaf-b425-43fa-8a82-ec60284c2188" ac:name="confiform-field" ac:schema-version="1"\>  
\<ac:parameter ac:name="overrideLabel"\>Link to Jira Issue\</ac:parameter\>  
\<ac:parameter ac:name="fieldName"\>jiraRef2.fields.issuetype.self\</ac:parameter\>  
\</ac:structured-macro\>  
\</p\>  
\</ac:rich-text-body\>  
\</ac:structured-macro\>

Trying to pass \[entry.Keys\] instead of \[entry.jiraRef2\] to the service URL and this is not working.

BR.

Stuart.


author: Alex Medved _ConfiForms_
body: You can reference the field itself, as noted in my earlier comment. There is no access to \[entry.Keys\] for the field jiraRef2

Besides, I see absolutely no point in having /rest/api/2/issue/\[entry.Keys\]

What do you wan to achieve? Set the value you want to set on Keys field to jiraRef2 field

Alex


Tags: confiforms

confluence-server

server