Skip to main content

We are trying to find a way to remove SAs from Items (as part of deactivation and deletion of employee data). We need these removed:

 Is there a process for this?

One option……

select ipx.item_id
,it.bpart_id
,it.serial_no
,ipx.unique_id
,ipx.person_id
,case when it.item_status = '3' then 'inventory_item' when it.item_status = '1' then 'item_installed' when it.item_status = '8' then 'removed_item' end as 'bc_name'
from item_person_xref ipx
join item it on ipx.item_id=it.item_id
where ipx.person_id='seal'

 

<root>
  <session email="" alias="">
    <state bc_name="item_installed">
      <action name="data-update">
        <main>
          <row>
            <item_id>7588857</item_id>
          </row>
        </main>
        <item_sa_xref>
          <row number="1" delete="true">
            <item_id>7588857</item_id>
            <unique_id>341</unique_id>
            <person_id>seal</person_id>
          </row>
        </item_sa_xref>
      </action>
    </state>
  </session>
</root>


Hi Bjørn,

Do you mean if there is an automated mechanism to do this in the application other than going through each item and removing them individually?  No, standard application does not do this.

There is an import: item_installed_maint-item_sa_xref which is used to define the SA’s on the item but there is not one for removing them.  I note this import is a manual API and perhaps a delete import can be made from this as a basis.

From the looks of it, Kyle’s API above may do what you need.  Thanks, Kyle!


Thanks, Kyle


Hi Kyle,

Your API deletes BOTH records as expected so I might enhance it a little to use a BO Search key to select the specific ID’s to delete in case someone only wishes to delete some of the records not all of them on the item person xref.

However, this is useful and again thanks!


BOTH records?

Should only delete one record from the Item SA xfer table using the item_ID, unique_id, and person_id

 

<root>
  <session email="" alias="">
    <state bc_name="item_installed">
      <action name="data-update">
        <main>
          <row>
            <item_id>7588857</item_id>
          </row>
        </main>
        <item_sa_xref>
          <row number="1" delete="true">
            <item_id>7588857</item_id>
            <unique_id>341</unique_id>
            <person_id>seal</person_id>
          </row>
        </item_sa_xref>
      </action>
    </state>
  </session>
</root>


I ran this via the Interactive API:

<root>
  <session email="" alias="">
    <state bc_name="item_installed">
      <action name="data-update">
        <main>
          <row>
            <item_id>92174</item_id>
          </row>
        </main>
        <item_sa_xref>
          <row number="1" delete="true">
            <item_id>92174</item_id>
            <unique_id>3793</unique_id>
            <person_id>905</person_id>
          </row>
        </item_sa_xref>
      </action>
    </state>
  </session>
</root>

 

There were two records, one for person 905 and another for person 902.  (I had a DB copy I could test it on our support environment).

Result was:

 


Thanks you guys!


It only deleted one record for me

 

 


Ok, I am checking with someone else who might have deleted the 902 record which I was not aware in between when I confirmed I had the data and then running the API.

Thank you for confirming your results.


Reply