<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.aras.com/community/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>call client method from sevrer</title><link>https://www.aras.com/community/f/development/3794/call-client-method-from-sevrer</link><description>How can i call client method from server?</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: call client method from sevrer</title><link>https://www.aras.com/community/thread/1666?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 04:25:10 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:b123816a-95c8-4f3e-9536-c88ddedd915c</guid><dc:creator>AngelaIp</dc:creator><description>Hi John,

it depends. There are multible ways to update something in Aras. These are the ones I have used so far:

1. &lt;code&gt;parent.onRefresh&lt;/code&gt; - I often use this one in the callback Method of Javascript Form handlers.
2. &lt;code&gt;aras.uiShowItem(&amp;quot;Part&amp;quot;, id);&lt;/code&gt; - just show an item
3. &lt;code&gt;aras.uiReShowItem(parentID,newID,&amp;#039;view&amp;#039;,&amp;#039;tab view&amp;#039;);&lt;/code&gt; - reshow item
4. &lt;code&gt;aras.uiReShowItemEx(parentID,doc.newItem.node);&lt;/code&gt; - similar to uiReShowItem
5. &lt;code&gt;aras.clearClientMetadataCache();&lt;/code&gt; 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.

&lt;pre&gt;&lt;code&gt;var bomID = this.getID(); // get id of BOM relationship
var body =  &amp;quot;&amp;lt;bom_&amp;gt;&amp;quot; + bomID + &amp;quot;&amp;lt;/bom_&amp;gt;&amp;quot;;
var result = aras.applyMethod(&amp;quot;My server Method&amp;quot;,body); // do some server side stuff

parent.onRefresh(); // Refresh Part
return null;&lt;/code&gt;&lt;/pre&gt;


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&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: call client method from sevrer</title><link>https://www.aras.com/community/thread/1659?ContentTypeID=1</link><pubDate>Wed, 06 Jun 2018 10:52:15 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:8d15de42-2128-42ec-8d1f-7612e7448ea6</guid><dc:creator>jtensmeyer</dc:creator><description>Angela,

That is a nice solution.  Thanks for sharing it.  Do you think the On Complete method approach could also be used to simply refresh the item form?  I have a problem where my server method saves and unlocks the item, but the form still shows the item as locked.  I am hoping this would be a good way to clean that up.

Thanks,

John&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: call client method from sevrer</title><link>https://www.aras.com/community/thread/1637?ContentTypeID=1</link><pubDate>Fri, 01 Jun 2018 10:25:37 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:cbe13a1c-b086-40b6-9976-81edbe768695</guid><dc:creator>AngelaIp</dc:creator><description>As soon as I type something in the forum, I normally have an idea for solution 1 hour later...
My usecase can be solved by an extra Method in the Action &lt;code&gt;On Complete&lt;/code&gt; field. I added this code and was able to improve the &amp;quot;refresh&amp;quot; behaviour:

&lt;pre&gt;&lt;code&gt;var inn = this.getInnovator();
var parentItm = this.getType();
var parentID = this.getID(); 

// Get the config_id
var item = inn.newItem(parentItm, &amp;quot;get&amp;quot;);
item.setID(parentID);
item.setAttribute(&amp;quot;select&amp;quot;,&amp;quot;config_id&amp;quot;);
item = item.apply();
var configID = item.getProperty(&amp;quot;config_id&amp;quot;);
 
// get the most recent part with config_id
var currentItm = inn.newItem(parentItm, &amp;quot;get&amp;quot;);
currentItm.setProperty(&amp;quot;config_id&amp;quot;, configID);
currentItm.setProperty(&amp;quot;is_current&amp;quot;, &amp;quot;1&amp;quot;);
currentItm = currentItm.apply();

// show new item in frame of previous item
aras.uiReShowItem(parentID,currentItm.getID(),&amp;#039;view&amp;#039;,&amp;#039;tab view&amp;#039;);&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: call client method from sevrer</title><link>https://www.aras.com/community/thread/1633?ContentTypeID=1</link><pubDate>Fri, 01 Jun 2018 08:33:05 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:76dc5a9c-2eef-4a84-a997-a0ff460f9d46</guid><dc:creator>AngelaIp</dc:creator><description>Hi,

I have also one use case where it would be helpful to call a client Method from a server Method. But maybe there is also another way to solve it.

The Action &lt;code&gt;PE_CreateNewRevision&lt;/code&gt; 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 &amp;quot;PE_CreateNewRevision&amp;quot;. Also &amp;quot;PE_CreateNewRevision&amp;quot; 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?

Angela&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: call client method from sevrer</title><link>https://www.aras.com/community/thread/1621?ContentTypeID=1</link><pubDate>Wed, 30 May 2018 08:37:08 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:8a418562-08cd-4ba5-ae82-e2da48e349ca</guid><dc:creator>Christopher Gillis</dc:creator><description>Hi Mily,

Where is your server method being called from? If the method is being called from a Server Event on an ItemType, you can use a line like &lt;code&gt;return inn.newError(&amp;quot;My warning message&amp;quot;);&lt;/code&gt; to display a dialog with to the user.

Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: call client method from sevrer</title><link>https://www.aras.com/community/thread/1615?ContentTypeID=1</link><pubDate>Wed, 30 May 2018 08:28:07 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:a99cba6d-f006-4db2-bb6e-00484813abd2</guid><dc:creator>Kara</dc:creator><description>Thanks for help..

In this scenario i want to give a call to client method  where i am using &amp;quot;alertWarning &amp;quot; through server events?

how i can achieve this? By any other different ways?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: call client method from sevrer</title><link>https://www.aras.com/community/thread/1613?ContentTypeID=1</link><pubDate>Tue, 29 May 2018 09:22:08 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:304cfe5b-8d84-4432-a75d-6351d88795d5</guid><dc:creator>Christopher Gillis</dc:creator><description>Hello,

It is not possible to call a client method from within a server method. Could you elaborate on your use case for this? It&amp;#39;s likely possible to achieve the desired result through different means.

Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>