Please be aware there is a known issue with images on the Community. We are working to resolve this issue as quickly as possible. We apologize for the inconvenience. If you need urgent help in the meantime, please reach out to technical support or your Threekit representative.

How to set attibutes in catalog items by processing other attributes values, using custom script.

Comments

4 comments

  • Michael  Woelfel
    Michael Woelfel

    Hi Vineet Tanwar, I would recommend using the standard "conditions" & "actions" operations within the Rule UI if possible because the custom script may change the behavior of other features within Threekit in unexpected ways. However you can find documentation on the APIs used for custom scripts here: https://community.threekit.com/hc/en-us/articles/4406068592539

    For example you can set an attribute's value by using the following:

    configurator.setConfiguration({ Color: 'Blue' });

    Where 'Color' is the attribute name and 'Blue' is the desired value


    We also have an additional documentation page with more information about custom scripts, including a working example here: https://community.threekit.com/hc/en-us/articles/4405866601243-Example-Custom-Script

    0
  • Tony
    Tony

    Vineet Tanwar if you're just setting the value of an attribute based on other attributes, a data table lookup should work just fine. 

    You can set up a data table with each column header as the name of your attributes, and each row will be a representation of your attributes combinations (IDs for reference attributes, strings for strings). 

    In your Catalog Item rule you won't need a condition since those will be in the query parameters of your action.

    Just select the attribute you want to set in your action, your operator will be a data-table query. You can select the column you want to target to set the value of your attribute, and your "query parameters" will match the input attributes to the corresponding columns. 

    https://community.threekit.com/hc/en-us/articles/4418420614299-Data-Tables-Use-Cases-and-Examples

    1
  • Vineet Tanwar
    Vineet Tanwar

    Tony, thanks for replying. 

    But actually it would not work for me, as I also needs to write custom script for calculating the value of my attribute.

    So I think, simple if-else condition would not work for me

    0
  • William  Thompson
    William Thompson

    Hi Vineet - have you found our example custom script documentation to be helpful at all?  In a custom script you should be able to retrieve the current configuration by calling the following in your script:

    const config = api.configurator.getConfiguration();
    

    From there you should be able to perform the logic you need and then set the configuration with the proper values. Let me know if this is helpful or if I can provide some more help. 

    0

Please sign in to leave a comment.

Powered by Zendesk