Skip to main content

Modifying elements within a workflow

Comments

7 comments

  • Zendesk API User
    Author: tklein - 11/15/2013 13:27

    Hi Jereon,

    I'm not sure if I understood the problem correctly,

    > But the flow only allowes IDProviders as context which cant be changed.

    You cannot get the Entity to make changes for that? Is it right?

    You can get the Entity with this code:

    workflowable = context.getWorkflowable();

    if(workflowable instanceof ContentWorkflowable) {

         Entity = ((ContentWorkflowable) workflowable).getEntity();

    }

    If this doesn't solve your problem, please post some code here for a better support..

    0
  • Zendesk API User
    Author: jdehaas - 11/19/2013 12:37

    Going to add some code will state when done.

    0
  • Zendesk API User
    Author: jdehaas - 11/19/2013 12:41

    Set data step: used from the external JMS Client that receives an event and start the worflow.

    Verify: data, the idea is to do a technical validation of the xml event here (data xsd)

    Edit:data: user can start a data form and verifies data, correct the data when necesariy.

    Persist data: data will be persisted into the form datasource.

    0
  • Zendesk API User
    Author: jdehaas - 11/19/2013 12:55

    Verify data script (Idea is to do an xsd check here we did a simple text check for purpose of simplicity)

    Text is provide by the Java client.

    #begin script

    valid = false;

    text = context.getWorkflowContext().getTask().getCustomAttributes().get("text");

    if (text != null && !text.trim().equals("")) {

              valid = true;

    }

    if (valid) {

              context.doTransition("valid");

    } else {

              context.doTransition("invalid");

    }

    0
  • Zendesk API User
    Author: jdehaas - 11/19/2013 12:56

    Persist data (allows editing and persist the data, simple text box will be a big form in the future implementation), Ideally we want to call the datasource form here but we cant edit data this is a open question!!!!:

    #begin script

    import javax.swing.JOptionPane;

    import de.espirit.firstspirit.access.store.Store;

    import de.espirit.firstspirit.access.store.IDProvider;

    String showInput(String message,Object value) {

              return JOptionPane.showInputDialog(message,value);

    }

    lang = context.getProject().getMasterLanguage();

    result = showInput("Please specify your text:", context.getWorkflowContext().getTask().getCustomAttributes().get("text"));

    if (result != null && !result.trim().equals("")) {

              us = context.getUserService();

              cs = us.getStore(Store.Type.CONTENTSTORE, false);

              c2 = cs.getStoreElement("message", IDProvider.UidType.CONTENTSTORE);

              e = c2.getSchema().getSession().createEntity(c2.getEntityType().getName());

              ds = c2.getDataset(e);

              ds.setLock(true);

              fd = ds.getFormData();

              ff = fd.get(lang, "cs_text");

              ff.set(result);

              ds.setFormData(fd);

              ds.save();

              ds.release();

              ds.setLock(false);

    }

    context.doTransition("end_workflow");

    0
  • Zendesk API User
    Author: MichaelaReydt - 11/19/2013 13:58

    Hello,

    when I understand your posting right, you try to edit an entity of a datasource by using a script, which is started by a workflow?

    Maybe this blogposting (click) can help you. It describes how to create, read, update and delete data records (entities) in FirstSpirit data sources by using a script.

    best regards

    Michaela

    0
  • Zendesk API User
    Author: pavone - 12/3/2013 8:02

    Hello Jeroen,

    do you need further help or did Michaela's reply already help you? If so, it would be great if you marked her reply as "correct answer" so that other community users find the solution easily. If you have already found a solution by yourself, it would be very kind of you, if you posted it here.

    Best regards

    Tim

    0

Please sign in to leave a comment.