How to Update Record in Custom Module using module builder - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

How to Update Record in Custom Module using module builder

  • How to Update Record in Custom Module using module builder
  • Hi,

    I'm Create dynamic module  using module builder,

    There is no Code-reference for Update Record,

    please help me how to update record using coding 

     Thanks,

    Shareef

  • Hi Shareef,

    I suppose you want to update a dynamic content item? The sample code is in the "Get a ... by ID" section of the code reference. If that section is not there, you'd best report that to Telerik.

  • Hello all,

    @ Shareef,

    You are correct, there is no Code Reference for updating a Dynamic Item. The way you can do that is by using the SetValue extention method. Here is a code example for the Press Releases module. It will update a field named TextField of an item with title Text:
    using Telerik.Sitefinity.Model;
     
    DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
                Type richTextType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.RichTextFieldTest.RichText");
     
                var richTextItem = dynamicModuleManager.GetDataItems(richTextType);
     
                foreach (var item in richTextItem)
                
                    if (item.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Master && item.GetValue("Title") == "Test")
                    
                        item.SetValue("TextField", "Your Updated Text");
     
                    
                       
                


    Regards,
    Ivan D. Dimitrov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items