function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
oracleoracle 

update xml not sucessfully,, ...

Product object have a property Product_Descritpion.

it's a Testarea.

when set Product_Description context is <h1>abc</h1>. click save.

web service side not change..

when set Product_Description context is String.click save.

test can be successfully.

 

before  Product_Description property is Text .

when set Product_Description context is <h1>abc</h1>. i can < change &lt;  > change &gt.

but.Textarea  not can..why?

 

 

thanks...

 

 

Shilpa_SFShilpa_SF

Hi,

 

    To understand your issue in better, Could you please provide me the Sample Code/Steps clearly so that i could help you in giving a solution.

oracleoracle

ok.

 

first

trigger changeProductRecordToVolusion on Product2 (after update)
{
    List<Id> products = new List<Id>();
    for(Product2 product : Trigger.new)
    {
        products.add(product.Id);
    }
    VolusionProductService.updateProducts(products);
}

 

second

   @future(callout=true)
   public static void updateProducts(List<Id> ProductIDs)
   {   
       List<ProductInfo> Products = new List<ProductInfo>();
       ProductInfo Product = new ProductInfo();
       for(Product2 child: [select ProductID__c,Vendor_PartNo__c,ProductCode,Description,Name,ProductPopularity__c,ListPrice__c,ProductPrice__c,ProductPrice_Name__c,ProductWeight__c,(select UnitPrice from PricebookEntries where Pricebook2.Name='Standard Price Book' and IsActive=true limit 1) from Product2 where Id in :ProductIDs])
       {
           Product = new ProductInfo();
           Product.ProductID = child.ProductID__c;
           Product.Product_Code = child.ProductCode;      
           Product.Product_Name = child.Name;
           try
           {
system.debug(':::::::child.Description' + child.Description);
system.debug(':::::::child.ProductPrice_Name__c' + child.ProductPrice_Name__c);
           Product.ProductPrice_Name = child.ProductPrice_Name__c.replaceAll('<','&lt;').replaceAll('>','&gt;');
           //Product.ProductPrice_Name = child.ProductPrice_Name__c;
          // Product.Product_Description = child.Description;
           Product.Product_Description = String.valueOf(child.Description).replaceAll('<','&lt;').replaceAll('>','&gt;');
           
           Product.ProductPopularity =  child.ProductPopularity__c.intValue();
           } catch(Exception ex)
           {
             Product.ProductPopularity = 0;
             Product.ProductPrice_Name = '';
             Product.Product_Description = '';
           }
           Product.ListPrice = child.ListPrice__c;
           Product.ProductPrice  = child.ProductPrice__c;
           Product.Vendor_PartNo = child.Vendor_PartNo__c;
           Product.ProductWeight = child.ProductWeight__c;
system.debug(':::' + Product);
           Products.add(Product);   
       }
       String ProductXml = '<?xml version="1.0" encoding="UTF-8" ?><xmldata>';
       for(ProductInfo Productinfo : Products)
       {   
           ProductXml += Productinfo.getXml();   
       }
       ProductXml += '</xmldata>';
       System.debug(':::::::::::::::::'+ProductXml);
       String url = VolusionServiceBase.getServiceUrl('&Import=Update');
       VolusionServiceBase.sendRequest(url, 'POST', ProductXml, true);
   }

 

question:

Product.ProductPrice_Name = child.ProductPrice_Name__c.replaceAll('<','&lt;').replaceAll('>','&gt;'); update no problem.  ProductPrice_Name__c is Text type.

 Product.Product_Description = String.valueOf(child.Description).replaceAll('<','&lt;').replaceAll('>','&gt;');   update not successfully.Description is textarea type.

 

if Description include html taglib,sendRequest will not update successfully.