How do update item in Dom after server Method changed values of a Form dropdown

Hi community,

hope somebody can help me on this one. I have a Form with a button that shall allow users to add additional values to the dropdown list. The button Client Method calls a 2nd Server Method that takes care for updating the List that is used in the dropdown. Used Innovator version is 12SP3, but I think my described scenario fits to most Innovator versions. 

The List update on server side works without any problems. The List will contain the new values on database level. But I am not able to update/refresh the dropdown list in the Form. Users still see the previous content. If users want to see the new updated List, they have to delete their browser cache completely. Neither the refresh button or reopening the item will make the additional list content visible. The only way the list will be updated without deleting the browser cache is when I manually save the List item again.

How can I solve this one? I assume I will need to use  aras.isDirtyEx or something similar. But I haven´t found much code samples on this one. Any ideas how to do this?

Angela

  • Hi community, 

    I think a small code sample maybe helps to find the missing piece. The following two Methods are extreme simplified versions of my current code. 

    The Javascript Method is called from an onClick button event in a Form. The Server Method will later grant the necessary permissions and update the list item. This list item is used for a dropdown list in the same Form. But unfortunately I still weren´t able to figure out how to get the new List values into my DOM item.

    My Server method shall return a result string instead of the edited item. The result contains some information if the list was updated or if the new value was already contained in the list (not included in sample code). This sample here will just add some static new value to the list. 

    I assume my update problem is mainly based on the fact that I return a helpful string text text instead of the edited list item. But I wonder if can update the Form dropdown without passing the list item?

    Javascript onClick button event

    var result = aras.applyMethod("MY_SERVER_METHOD");
    if (!result)
    {
       return; // No alert necessary. Error message thrown by Server Method
    }

    // get result text passed by server method with inn.newResult(...);
    var parser = new DOMParser();
    var xmlDoc = parser.parseFromString(result,"text/xml");
    var resultInfo = xmlDoc.getElementsByTagName("Result")[0].childNodes[0].nodeValue;

    return aras.AlertSuccess(resultInfo);

    Server method MY_SERVER_METHOD - writes a new Value into an existing List (sample is very hardcoded):

    Innovator inn = this.getInnovator();

    Item editList = inn.getItemById("List", "FA55766F5F2540DDBA94AD79E9D82711"); // List id of 'MyList' used for dropdown
    editList.setAction("edit");
    Item addValue = inn.newItem("Value","add");
    addValue.setProperty("label", "newvalue");
    addValue.setProperty("value", "newvalue");
    editList.addRelationship(addValue);
    editList = editList.apply();


    string result = "Value xy was added"; // fake result for keeping this code sample simple...
    return inn.newResult(result); // return result as string to javascript Method

  • Hi,

    it finally turned out, that my wonderful idea is not possible at all. Regarding to Aras there is some kind of restriction in the caching mechanism, so it´s right now not possible to do this kind of customization with standard Methods. This also explains why we haven´t seen any solution for this use case so far. As far as I remember, adding values to a drop down within the Form is a common request. Maybe it will be possible in a couple of years :).

  • We had similar requirement, ended up storing the values added by user to a new item type along side the LOV ID, and load them along with LOV with custom code. And each release we merged the ones that got approved to actual LOV. It was a 11SP15 customization, looking for a better way in 12SP3