Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Marc-André 63 posts 279 karma points
    Aug 13, 2019 @ 18:14
    Marc-André
    0

    How to update a content field value

    Hello!

    I was wondering how to update a custom field value from code.

    Is there an UmbracoHelper method to do that?

    Thanks!

  • Paul Sterling 719 posts 1556 karma points MVP 9x admin c-trib
    Aug 13, 2019 @ 18:30
    Paul Sterling
    100

    Generally for CRUD operations you'll use the Service APIs that are found in

    Umbraco.Core.Services
    

    The official docs, with code samples, are here https://our.umbraco.com/documentation/Getting-Started/Code/Umbraco-Services/

    Using the ContentService you can set the value of the custom property to the value you need. Then, once your values are set, you Save or Save and Publish

    https://our.umbraco.com/apidocs/v7/csharp/api/Umbraco.Core.Services.ContentService.html#UmbracoCoreServicesContentServiceSaveAndPublishWithStatusUmbracoCoreModelsIContentSystemInt32SystemBoolean_

    Once you get the hang of it, all/most of the Service APIs use the same pattern.

    -Paul

  • Marc-André 63 posts 279 karma points
    Aug 14, 2019 @ 13:53
    Marc-André
    0

    Awesome! :D

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies