how to use javascript functions in input form

Avatar

Avatar

dikshac45201755

Avatar

dikshac45201755

dikshac45201755

03-04-2018

I want to implement my java script function through form rather than workflow. When user put values in form at that moment i want to data to get reflected to user.

Thanks,

Diksha

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

MarcelSzimonisz

MVP

Avatar

MarcelSzimonisz

MVP

MarcelSzimonisz
MVP

10-05-2018

Hello dikshac45201755​,

You need to implement input button in your form which will call method in your schema

Some information can be found here:

1. In your form add input

Form structure

<input enabledIf="" img="" label="Label" type="button">

     <enter>

       <soapCall name="soapCallName" service="namespace:schema"> // xtk:workflow

           <param exprIn="[@attribute1]" type="boolean"/>

           <param exprIn="[element/@attribute2]" type="int"/>

           <param exprIn="[attribute3]" type="string"/>

           ..

           ..

        </soapCall>

        <reload/>

      </enter>

</input>

2. In your schema add method

Schema structure

<method library="namespace:yourJavaScript.js" name="soapCallName" static="true">

    <parameters>

      <param inout="in" name="attribute1" type="boolean"/>

      <param inout="in" name="attribute2" type="long"/> // it does not know int type 🙂

      <param inout="in" name="attribute3" type="string"/>

        ..

        ..

    </parameters>

</method>

3. Last but not least add your JS function to JavaScript codes folder:

Implementing SOAP methods

Data oriented APIs

Can be something as below:

function namespace_schema_soapCallName(attribute1, attribute2, attribute3,..,..){ 

   xtk.session.Write(<schema xtkschema="namespace:schema"

      _operation="update" attribute1={attribute1}  attribute2={attribute2}  attribute3={attribute3} ...

      _key="@attribute2"

  />);

}

llName

Marcel

Answers (8)

Answers (8)

Avatar

Avatar

pierrec70731455

Avatar

pierrec70731455

pierrec70731455

18-04-2019

Hi dikshac45201755,

The logs are just going to be visible int the web@default.

If you want to print the logs in some workflow logs you are probably going to have :

* add a dummy activity in your workflow

* create a task with NLWS.xtkWorklflowTask.create(...) with the workflowID

* create the logs with NLWS.xtkWorkflowLog.create(...) with the newly created taskID and the workflowID

Pierre

Avatar

Avatar

saikatk2447661

Avatar

saikatk2447661

saikatk2447661

13-09-2018

Faced same issue. Ended up creating custom schema to store debug info with custom methods.

Avatar

Avatar

MarcelSzimonisz

MVP

Avatar

MarcelSzimonisz

MVP

MarcelSzimonisz
MVP

13-09-2018

i do no know what is javascript code inside button click ..Do you mean in web apps?  there is no debug tool only debug i could use was logError(ctx) but triggered from web browser to speed up the process..

Avatar

Avatar

Aalokitoaami

Avatar

Aalokitoaami

Aalokitoaami

12-09-2018

marcel.gent.86​,

Sorry if I am missing anything. But here we are talking about input forms and I am adding the Javascript code inside the button click. So the logInfo is not associated with any workflow.

I checked the XtkWorkflowLog table also to be double sure and also checked the XtkJobLog. But there is not reference to the log. Any help is really appreciated. I am doing alert("message") for debug but seems that button click just allows the first alert. Any subsequent alerts are suppressed.

Avatar

Avatar

MarcelSzimonisz

MVP

Avatar

MarcelSzimonisz

MVP

MarcelSzimonisz
MVP

12-09-2018

In the workflow Journal you can see log info

2018-09-12_09-29-53.png

Avatar

Avatar

Aalokitoaami

Avatar

Aalokitoaami

Aalokitoaami

11-09-2018

Hi marcel.gent.86​,

I want to try the same thing and trying to use the logInfo function inside the javascript as mentioned in Implementing SOAP methods But I don't know where these logInfo store the messages. For workflpow it writes to log. Where does the input form stores the messages?

Thanks,

Tarun

Avatar

Avatar

florentlb

Total Posts

1.1K

Likes

234

Correct Answer

239

Avatar

florentlb

Total Posts

1.1K

Likes

234

Correct Answer

239
florentlb

09-05-2018

Hi Diksha,

Any update to share on this?

Florent

Avatar

Avatar

florentlb

Total Posts

1.1K

Likes

234

Correct Answer

239

Avatar

florentlb

Total Posts

1.1K

Likes

234

Correct Answer

239
florentlb

18-04-2018

Hi Diksha,

To make sure we understand, can you provide a more detailed example of what you are trying to achieve?

Florent