When user opens a new case, I need to check if the serial number of the new case already exists in order to change the priority of the case. I use Kaskela's solution to do this and I think the best way to do it is to use query to get a single value (what I actually want to get is a true or false boolean). Serial Number is a lookup field, so it will be always a GUID - 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) but I have to make the query using as input the name attribute of the serial number (i.e. SN00105GH)
this is the fetchXML I use so far:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
<entity name="case" >
<attribute name="title" />
<link-entity name="abc_serialnumber" from="abc_serialnumberid" to="abc_serialnumberid" link-type="inner" alias="ac" >
<filter type="and" >
<condition attribute="abc_name" operator="like" value='{Serial Number(Case)}' />
</filter>
</link-entity>
</entity>
</fetch>
I get the error 'Case' entity doesn't contain attribute with Name = 'abc_serialnumberid' and NameMapping = 'Logical', which is true because 'abc_serialnumberid' belongs to 'abc_serialnumber' entity, but I am not sure how I should do it. Any help would be greatly appreciated
Thank you!
Hello,
you should replace the to="abc_serialnumberid" with the column name of the case entity unless you gave the name as abc_serialnumberid.
As suggested, you need to change the case to incident. Here is a fetch xml for quick reference.
fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="incident">
<attribute name="title" />
<attribute name="ticketnumber" />
<attribute name="createdon" />
<attribute name="incidentid" />
<attribute name="caseorigincode" />
<attribute name="new_serialnumber" />
<order attribute="title" descending="false" />
<link-entity name="new_serialnumber" from="new_serialnumberid" to="new_serialnumber" link-type="inner" alias="ad">
<filter type="and">
<condition attribute="new_name" operator="eq" value="{Serial Number(Case)}" />
</filter>
</link-entity>
</entity>
</fetch>
Best Regards
PG
Hello,
Schema name for Case is incident. Try to use following line
<entity name="incident" >
instead of
<entity name="case" >
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,912 Super User 2024 Season 2
Martin Dráb 229,355 Most Valuable Professional
nmaenpaa 101,156