How do I "edit"/"update" a Relationship instance using js or AML.

All,

I am trying to "edit"/"update" the properties on a Non-Related Relationship; "rh_OraMfgMaster_ProdNumNomen".

I must be missing something.

I tried the following AML from AML Studio:

<AML>
    <Item type="rh_Oracle_Manuf_Master_Item" action="edit" id="C323F3AB54D84E70B54D895158EE3CB7">
        <Relationships>
              <Item type="rh_OraMfgMaster_ProdNumNomen" action="edit"
                 where="[rh_OraMfgMaster_ProdNumNomen].source_id = 'C323F3AB54D84E70B54D895158EE3CB7'">
                     <RH_PRODUCT_CATEGORY_CODE>Z</RH_PRODUCT_CATEGORY_CODE>
                     <RH_TRADE_BRAND_CODE>F</RH_TRADE_BRAND_CODE>
              </Item>
      </Relationships>
  </Item>
</AML>

<AML>
    <Item type="rh_Oracle_Manuf_Master_Item" action="edit" id="C323F3AB54D84E70B54D895158EE3CB7">
        <Relationships>
              <Item type="rh_OraMfgMaster_ProdNumNomen" action="edit" id="3A40258510F24D1685B044270F4B296A">
                     <RH_PRODUCT_CATEGORY_CODE>Z</RH_PRODUCT_CATEGORY_CODE>
                     <RH_TRADE_BRAND_CODE>F</RH_TRADE_BRAND_CODE>
              </Item>
      </Relationships>
  </Item>
</AML>

This does not work.

I tried [Item type="rh_OraMfgMaster_ProdNumNomen" action="update"] and that did not work.

I can delete the existing Relationship using:

<AML>
    <Item type="rh_Oracle_Manuf_Master_Item" action="edit" id="C323F3AB54D84E70B54D895158EE3CB7">
        <Relationships>
              <Item type="rh_OraMfgMaster_ProdNumNomen" action="delete" id="A9BB4FEB593F4D09A5427B108937B216">
              </Item>
      </Relationships>
  </Item>
</AML>

And then Add a new Relationship instance (with 'hasProdNomen ' = "NO") with the updated data.

        let hasProdNomen = HasProductNomenclature(parentId);
        let arasAction = "edit";
        if(hasProdNomen === "NO"){ arasAction = "add";}
        //let oracleMasterItem = inn.getItemById("rh_Oracle_Manuf_Master_Item",parentId);

        let prodNumNomen = inn.newItem("rh_OraMfgMaster_ProdNumNomen", arasAction);
        if(hasProdNomen === "YES"){
            prodNumNomen.setAttribute("Where", "[rh_OraMfgMaster_ProdNumNomen].source_id = " + parentId);
        }
        
        prodNumNomen.setProperty(itemProductNumberPropName, prodNumItemNumber);
        prodNumNomen.setProperty(tradeBrandPropName, tradeBrand);
        prodNumNomen.setProperty(tradeBrandCodePropName, tradeBrandCode);
        prodNumNomen.setProperty(productCategoryPropName, prodCategory);
        prodNumNomen.setProperty(productCategoryCodePropName, prodCatCode);
        prodNumNomen.setProperty(numberOfPositionsPropName, numberOfPositions);
        //let prodNumNomenCnt = prodNumNomen.getItemCount();
        //debugger;            
        let cnt = -1;
        let prodNumNomenCheck = null;
        if(hasProdNomen === "NO"){
            //debugger;
            item.addRelationship(prodNumNomen);
            item.apply();
         } else if(hasProdNomen === "YES"){
            prodNumNomenCheck = prodNumNomen.apply();
            cnt = prodNumNomenCheck.getItemCount();
        }

But I would rather update the properties on the Relationship item.

Thanks for the help.

Scott

  • Is there any error in the result? At least second AML should work, although the source item edit is unnecessary. If you know the relationship id the

    <Item type="rh_OraMfgMaster_ProdNumNomen" action="edit" id="3A40258510F24D1685B044270F4B296A">
       <RH_PRODUCT_CATEGORY_CODE>Z</RH_PRODUCT_CATEGORY_CODE>
       <RH_TRADE_BRAND_CODE>F</RH_TRADE_BRAND_CODE>
    </Item>

    should be enough.

  • alaxala,

    Thanks for responding.

    That's what is confusing, there are no errors thrown.

    No system feedback at all.

    Scott

  • alaxala,

    Sorry ... I closed the reply before I completed the comment.

    Using the following AML:

    <AML>
        <Item type="rh_Oracle_Manuf_Master_Item" action="edit" id="C323F3AB54D84E70B54D895158EE3CB7">
            <Relationships>
                  <Item type="rh_OraMfgMaster_ProdNumNomen" action="edit"
                     where="[rh_OraMfgMaster_ProdNumNomen].source_id = 'C323F3AB54D84E70B54D895158EE3CB7'">
                         <RH_PRODUCT_CATEGORY_CODE>K</RH_PRODUCT_CATEGORY_CODE>
                         <RH_TRADE_BRAND_CODE>T</RH_TRADE_BRAND_CODE>
                  </Item>
          </Relationships>
      </Item>
    </AML>

    When I look at the AML server response I get ....

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="">schemas.xmlsoap.org/.../">
      <SOAP-ENV:Body>
        <Result>
          <Item type="rh_Oracle_Manuf_Master_Item" typeId="8C4C0C666B564C928824E229F4476D1E" id="C323F3AB54D84E70B54D895158EE3CB7">
            <classification>Finished good</classification>
            <config_id keyed_name="18287161" type="rh_Oracle_Manuf_Master_Item">C323F3AB54D84E70B54D895158EE3CB7</config_id>
            <created_by_id keyed_name="Manufacturing Batch Loader" type="User">7F42F026A2BC4EE99066DD094F3610D5</created_by_id>
            <created_on>2023-09-10T22:06:01</created_on>
            <rh_mfg_weight_code>LB</rh_mfg_weight_code>
            <rh_plm_cre_by_div>AC</rh_plm_cre_by_div>
            <rh_plm_description>SMALL - 26 TUBE - 1.5 TON</rh_plm_description>
            <rh_plm_has_change_pending>0</rh_plm_has_change_pending>
            <rh_plm_major_rev>00</rh_plm_major_rev>
            <rh_plm_make_buy>Make</rh_plm_make_buy>
            <rh_plm_part keyed_name="RA14AZ18AJ1NA" type="Part">BB42DF0F494D415288532C2323D388B0</rh_plm_part>
            <rh_plm_plm_created_by_div>AC</rh_plm_plm_created_by_div>
            <rh_oracle_item_id>18287161</rh_oracle_item_id>
          </Item>
        </Result>
        <Message>
          <event name="ids_modified" value="C323F3AB54D84E70B54D895158EE3CB7|3A40258510F24D1685B044270F4B296A" />
        </Message>
      </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

    If I look at the SQL Server Table the only thing that has changed is the [modified_on] property.

     

    I also tried using the ID of the relationship:

    <AML>
        <Item type="rh_Oracle_Manuf_Master_Item" action="edit" id="C323F3AB54D84E70B54D895158EE3CB7">
            <Relationships>
                  <Item type="rh_OraMfgMaster_ProdNumNomen" action="edit" id="3A40258510F24D1685B044270F4B296A">
                         <RH_PRODUCT_CATEGORY_CODE>K</RH_PRODUCT_CATEGORY_CODE>
                         <RH_TRADE_BRAND_CODE>T</RH_TRADE_BRAND_CODE>
                  </Item>
          </Relationships>
      </Item>
    </AML>

    Same result.

  • The property names in the AML are case sensitive. So you must specify them exactly as they are defined in the Aras itemType, not in the SQL table.

  • alaxala,

    Wow I can't believe I missed that.

    Good catch. Its the simple stuff that ....s me.

    Thank you

    Scott