return inn.newError("My warning message");
to display a dialog with to the user.
Chris
PE_CreateNewRevision
can be used to create a new manual revision of a Part.
In most cases, the Form and Relationships update automatically after clicking the Action. But sometimes that does not work, e.g. when repating this Action. I also have seen that sometimtes the Form will update, but the Relationships still link to the old source_id. It´s not a big issue right now, but sometimes users are forced to reopen the Parts and repeat the changes.
So it would be practical if the Form and Relationship always (!) refreshes automatically after clicking "PE_CreateNewRevision". Also "PE_CreateNewRevision" is a CSharp server method, so I don´t know how to add the Javascript refresh there. One option is maybe, to rewrite the Action to a client version that calls another CSharp Method for updating the database values.
I also do not want to exclude that I have some mistake in my code that prevents the refresh. But maybe somebody knows an easy and elegant way to improve this?
AngelaOn Complete
field. I added this code and was able to improve the "refresh" behaviour:
var inn = this.getInnovator();
var parentItm = this.getType();
var parentID = this.getID();
// Get the config_id
var item = inn.newItem(parentItm, "get");
item.setID(parentID);
item.setAttribute("select","config_id");
item = item.apply();
var configID = item.getProperty("config_id");
// get the most recent part with config_id
var currentItm = inn.newItem(parentItm, "get");
currentItm.setProperty("config_id", configID);
currentItm.setProperty("is_current", "1");
currentItm = currentItm.apply();
// show new item in frame of previous item
aras.uiReShowItem(parentID,currentItm.getID(),'view','tab view');
parent.onRefresh
- I often use this one in the callback Method of Javascript Form handlers.
2. aras.uiShowItem("Part", id);
- just show an item
3. aras.uiReShowItem(parentID,newID,'view','tab view');
- reshow item
4. aras.uiReShowItemEx(parentID,doc.newItem.node);
- similar to uiReShowItem
5. aras.clearClientMetadataCache();
I have seen this often in other samples here in the Forum, but I prefer the other options.
For updating the grid there are other options avaiable (runSearch, updateRow). You can find them often in the code of CUI elements.
Maybe this one is also option for you. This is a very reduced breakout from an Action I use in the BOM Relationship. It updates the Form after the job were done.
var bomID = this.getID(); // get id of BOM relationship
var body = "<bom_>" + bomID + "</bom_>";
var result = aras.applyMethod("My server Method",body); // do some server side stuff
parent.onRefresh(); // Refresh Part
return null;
From my current POV, the above sample is not as reliable as I expected it to be and still requires some further testing. So maybe this one is a better option.
Angela