<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Validation Script problem in Fusion Manage Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6649261#M4174</link>
    <description>&lt;P&gt;Thanks for your patience Dany. &amp;nbsp;I have only had 2 days training total so my knowledge is extremely limited. &amp;nbsp;I have revised my script per your post and when I debug, I can see that the field is being linked. &amp;nbsp;I get the correct response message when I try to move the workflow to the next step without entering anything in the field, however I also get the same response message when I put "yes" or "no" in the field. &amp;nbsp;So the workflow will stop me no matter what is in the field at this point. &amp;nbsp;Do you have any other suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, do you have any suggestions on books that are available for learning scripts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I greatly appreciate your assistance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Carmen&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Oct 2016 11:34:03 GMT</pubDate>
    <dc:creator>Customer.Service</dc:creator>
    <dc:date>2016-10-27T11:34:03Z</dc:date>
    <item>
      <title>Validation Script problem</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6645010#M4168</link>
      <description>&lt;P&gt;I am new to scripting and am having a problem with a validation script I created (shown below) . &amp;nbsp;&lt;SPAN&gt;SUPPLIER_QUALITY_MANUAL is a radio button field. &amp;nbsp;My goal is to stop the workflow if this field is not completed. &amp;nbsp;At the moment it works in that it stops the workflow when the field is left blank however it also stops the workflow if the field is completed. &amp;nbsp;I think my problem is that the SUPPLIER_QUALITY_MANUAL field is in a different workspace from the workspace the workflow is in. &amp;nbsp;How do I direct the script to the correct workspace? &amp;nbsp;Any help would be greatly appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var messages = [];&lt;/P&gt;&lt;P&gt;if(item.SUPPLIER_QUALITY_MANUAL !== null){&lt;BR /&gt;messages.push('A response must be entered for "Supplier Quality Manual" ');&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;returnValue(messages);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Carmen&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 18:42:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6645010#M4168</guid>
      <dc:creator>Customer.Service</dc:creator>
      <dc:date>2016-10-25T18:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Validation Script problem</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6645191#M4169</link>
      <description>&lt;P&gt;The pattern that is usually used is to create a linking pick-list attribute to reference the record in the other workspace.&amp;nbsp; The picklist would refernce records in the other workspace, and the attribute would select one of those records to associate to the item.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I understand correectly the workflow is associated to the item.&amp;nbsp; So item.LINKING_PICK_LIST.SUPPLIER_QUALITY_MANUAL would refernce the associated attribute in the other workspace.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this help?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 19:40:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6645191#M4169</guid>
      <dc:creator>tony.mandatori</dc:creator>
      <dc:date>2016-10-25T19:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Validation Script problem</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6645948#M4170</link>
      <description>&lt;P&gt;Hello Carmen,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First of all, if you want to check if it is NOT set, you need to test for === null &amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var messages = [];
if(item.SUPPLIER_QUALITY_MANUAL &lt;STRONG&gt;===&lt;/STRONG&gt; null){&lt;BR /&gt;
  messages.push('A response must be entered for "Supplier Quality Manual" ');
&lt;BR /&gt;}
returnValue(messages);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From your comment about the "&lt;SPAN&gt;SUPPLIER_QUALITY_MANUAL field is in a different workspace from the workspace &lt;/SPAN&gt;", it seems that this field is on the Affected/Managed Item (the item you want to revision) and not on the workflow item directly (the revisioning item).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In both cases I assume that the radio button is from a custom picklist with yes and no, correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One thing to help you, you can set the "default" value of the&amp;nbsp;&lt;SPAN&gt;SUPPLIER_QUALITY_MANUAL so your new items will never be "empty"/null. Except of course if you actually "always" want the user to manually set a value.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the field description that I used for the code below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="supplier document.png" style="width: 663px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/285803iC2C25392CAE11085/image-size/large?v=v2&amp;amp;px=999" role="button" title="supplier document.png" alt="supplier document.png" /&gt;&lt;/span&gt;﻿&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example if it is the case (that the field is actually from the linked item in the Managed/Affected Item Tab. You need to loop through each linked revision controlled items under that revisioning item.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var messages = [];&lt;BR /&gt;&lt;BR /&gt;var wfiSize = item.workflowItems.length;&lt;BR /&gt;&lt;BR /&gt;var i;&lt;BR /&gt;for( i=0;i&amp;lt;wfiSize;i++){&lt;BR /&gt; &lt;BR /&gt; var wfi = item.workflowItems[i].item;&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; if(wfi.SUPPLIER_QUALITY_MANUAL &lt;STRONG&gt;===&lt;/STRONG&gt; null){&lt;BR /&gt; &lt;BR /&gt;   messages.push('A response must be entered for "Supplier Quality Manual" ');&lt;BR /&gt; &lt;BR /&gt; }else if(wfi.SUPPLIER_QUALITY_MANUAL === "Yes"){&lt;BR /&gt; &lt;BR /&gt;   //Do something if it shouldn't be yes&lt;BR /&gt;&lt;BR /&gt; }else if(wfi.SUPPLIER_QUALITY_MANUAL === "No"){&lt;BR /&gt; &lt;BR /&gt;   //Do something if it shouldn't be no&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;returnValue(messages);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And here the example if the field is on the Revisioning item itself (like you have in your example):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var messages = [];&lt;BR /&gt;&lt;BR /&gt;if(item.SUPPLIER_QUALITY_MANUAL &lt;STRONG&gt;===&lt;/STRONG&gt; null){
    
    &lt;SPAN&gt;messages.push('A response must be entered for "Supplier Quality Manual" ');&lt;/SPAN&gt;
    
}else if(item.SUPPLIER_QUALITY_MANUAL === "Yes"){
    
    //Do something if it shouldn't be yes&lt;BR /&gt;
}else if(item.SUPPLIER_QUALITY_MANUAL === "No"){
    
    //Do something if it shouldn't be no
}&lt;BR /&gt;returnValue(messages);&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 06:04:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6645948#M4170</guid>
      <dc:creator>dany.poudrier</dc:creator>
      <dc:date>2016-10-26T06:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Validation Script problem</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6646846#M4171</link>
      <description>&lt;P&gt;Thanks for the response. &amp;nbsp;I'm sorry if I did not supply enough context to my problem. &amp;nbsp;The workflow I placed the validation script in is linked to the workspace the field is in via a relationship. &amp;nbsp;The radio button is from a custom picklist with a yes and no option. &amp;nbsp;I know I can make the radio button a mandatory field but that option will not solve our problem. &amp;nbsp;I need the workflow to stop if the field is not answered. &amp;nbsp;When I run my current script I get the error...&lt;/P&gt;&lt;P&gt;Field SUPPLIER_QUALITY_MANUAL does not exist in the target workspace. This may be an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have very limited knowledge of scripting and may not have understood your response. &amp;nbsp;I did change the line in my script so my script now reads as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var messages = [];&lt;BR /&gt;if(item.LINKING_PICK_LIST.SUPPLIER_QUALITY_MANUAL === null){&lt;BR /&gt;messages.push('A response must be entered for "Supplier Quality Manual" ');&lt;BR /&gt;}&lt;BR /&gt;returnValue(messages);&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This returns an error .....&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There is an error in the script on line 2, column 0. TypeError: Cannot read property "SUPPLIER_QUALITY_MANUAL" from null (SMC_166_fields_required#2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Did I totally misunderstand??&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 14:07:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6646846#M4171</guid>
      <dc:creator>Customer.Service</dc:creator>
      <dc:date>2016-10-26T14:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Validation Script problem</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6646886#M4172</link>
      <description>&lt;P&gt;&lt;FONT face="times new roman,times" size="3"&gt;Hi Dany,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="2"&gt;&lt;FONT size="3"&gt;Thanks for the response. &amp;nbsp;I'm sorry, but I am not familiar with the wfi and wfisize statements and what they mean in this script and how to incorporate them. &amp;nbsp;I did correct my line to&amp;nbsp;test for === null.&lt;/FONT&gt; &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="1 2 3 4 5 6 7"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Verdana',sans-serif; color: black;"&gt;The workflow I placed the validation script in is linked to the workspace the field is in via a relationship. &amp;nbsp;The radio button is from a custom picklist with a yes and no option. &amp;nbsp;I know I can make the radio button a mandatory field but that option will not solve our problem. &amp;nbsp;I need the workflow to stop if the field is not answered. &amp;nbsp;When I run my current script I get the error...&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="1 2 3 4 5 6 7"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Verdana',sans-serif; color: black;"&gt;Field SUPPLIER_QUALITY_MANUAL does not exist in the target workspace. This may be an error.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="1 2 3 4 5 6 7"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Verdana',sans-serif; color: black;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="1 2 3 4 5 6 7"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Verdana',sans-serif; color: black;"&gt;Does the additional context help explain my problem better?&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="1 2 3 4 5 6 7"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Verdana',sans-serif; color: black;"&gt;Carmen&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 14:18:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6646886#M4172</guid>
      <dc:creator>Customer.Service</dc:creator>
      <dc:date>2016-10-26T14:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Validation Script problem</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6648886#M4173</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry about that confusion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assumed that you were a little more familiar with Javascript. &amp;nbsp;The wfi is just a variable name (I could have named it toto). But in your specific case you do not need it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The right code is bellow&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;item.&lt;STRIKE&gt;LINKING_PICK_LIST&lt;/STRIKE&gt;.SUPPLIER_QUALITY_MANUAL&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var messages = [];
if(&lt;STRONG&gt;item.SUPPLIER_QUALITY_MANUAL&lt;/STRONG&gt; === null){
   messages.push('A response must be entered for "Supplier Quality Manual" ');
}
returnValue(messages); &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2016 09:05:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6648886#M4173</guid>
      <dc:creator>dany.poudrier</dc:creator>
      <dc:date>2016-10-27T09:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Validation Script problem</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6649261#M4174</link>
      <description>&lt;P&gt;Thanks for your patience Dany. &amp;nbsp;I have only had 2 days training total so my knowledge is extremely limited. &amp;nbsp;I have revised my script per your post and when I debug, I can see that the field is being linked. &amp;nbsp;I get the correct response message when I try to move the workflow to the next step without entering anything in the field, however I also get the same response message when I put "yes" or "no" in the field. &amp;nbsp;So the workflow will stop me no matter what is in the field at this point. &amp;nbsp;Do you have any other suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, do you have any suggestions on books that are available for learning scripts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I greatly appreciate your assistance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Carmen&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2016 11:34:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6649261#M4174</guid>
      <dc:creator>Customer.Service</dc:creator>
      <dc:date>2016-10-27T11:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Validation Script problem</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6664643#M4175</link>
      <description>&lt;P&gt;Here is the final script after some more email discussions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bottom line, the customer has two workspaces and use relationship to link the two. &amp;nbsp;The attribute to validate the workflow is not on the workflow workspace but on one of the item of the relationship workspace.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the final code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var relationshipSize = item.relationships.length;

var messages = [];
var i;
for( i=0;i&amp;lt;relationshipSize;i++){
    
    var relationshipItem =  item.relationships[i].item;
    
    if(relationshipItem.master.workspaceID ===57){
    
        if(relationshipItem.SUPPLIER_QUALITY_MANUAL === null){
            
            messages.push('A response must be entered for "Supplier Quality Manual" for ' + relationshipItem.descriptor.descriptor );
            
        }else if(relationshipItem.SUPPLIER_QUALITY_MANUAL === "Yes"){
            
            //Do Something if needed for yes
        }else if(relationshipItem.SUPPLIER_QUALITY_MANUAL === "No"){
            
            //Do Something if needed for no
        }
    }
}
returnValue(messages);&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2016 11:51:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6664643#M4175</guid>
      <dc:creator>dany.poudrier</dc:creator>
      <dc:date>2016-11-03T11:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: Validation Script problem</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6665205#M4176</link>
      <description>&lt;P&gt;Thanks again for your assistance Dany. &amp;nbsp;The solution works like a dream!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Carmen&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 15:02:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/validation-script-problem/m-p/6665205#M4176</guid>
      <dc:creator>Customer.Service</dc:creator>
      <dc:date>2016-11-03T15:02:24Z</dc:date>
    </item>
  </channel>
</rss>

