Documentation

crm.product.update

crm.product.update(id, fields)

Updates an existing product.

Parameters

Parameter Description
id Product ID.
fields Set of fields is an array("updated field"=>"value"[, ...]), containing field values, returned by the crm.product.fields method. CURRENCY_ID must be specified to set a price.
Note: to find out the required field format, execute the method crm.product.fields to view the retrieved field format.

Example

 var id = prompt("Enter ID");
  BX24.callMethod(
   "crm.product.update", 
   { 
    id: id,
    fields:
    { 
     "CURRENCY_ID": ""USD"", 
     "PRICE": 5000
    }    
   }, 
   function(result) 
   {
    if(result.error())
     console.error(result.error());
    else
    {
     console.info(result.data());      
    }
   }
  ); 

Adding files to CRM by the highlighted method has its own particular specifics.

Within this call, a property value with identifier 124 is deleted and a new value with a file 1.jpg is added.

BX24.callMethod(
    "crm.product.update",
    {
        id: 4611,
        fields:
            {
                "PROPERTY_186": [
                    {
                        "valueId": 0,
                        "fileData": ["1.jpg", "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYH"
                        +"BwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMD"
                        +"AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAARABEDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAA"
                        +"AAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fA"
                        +"kM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWW"
                        +"l5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBA"
                        +"QEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRob"
                        +"HBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYa"
                        +"HiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oA"
                        +"DAMBAAIRAxEAPwDqvg78Hf8Ahawjt7eO+n1Ce5NvDDbso3YVWycg4xkkkkAAZOACa0vjF+z3J8ILO6j1CHULXULdI5Fjl"
                        +"kR0dWYDIKjDDkjIPUEdQRR+z38YofhBcQ6hHdR2+oWt20sayQtIrqyBCDgdCNw4IPPBBwa2P2hv2ho/jdbXV1dXVu140U"
                        +"UEMMFu8caIrhsDcM9SzZYk5PpgD+OcViuKVxTGlSi/qN1d2le/MtFpbl5d366q2vDk2TeGUvDJ4jEPBfXvqVaXvVoLEfW"
                        +"FCfIlDnvzX5bLlu38k/F6KKK/Xj+EQooooAKKKKAP/9k="]
                    },
                    {
                        "valueId": 124,
                        "value": {"remove": "Y"}
                    }
                ]
            }
    },
    function (result) {
        if (result.error())
            console.error(result.error());
        else
        {
            console.info(result.data());
        }
    }
);


User Comments

User comments are not part of official documentation. Use information provided by other users in the comments at your own risk.

The User Comments section is not to be used as a feature discussion board. Only registered users can post comments. Your comment will be visible once it has been approved by the moderator.
© «Bitrix Inc.», 2001-2020, «Bitrix Inc.», 2020