mapping data to sharepoint columns from logic app for Date

Ananya Dixith 101 Reputation points
2022-05-26T07:31:59.73+00:00

Hi,

I need to map data to sharepoint column through logic app

I want to map Date value to sharepoint column

I have created date column in SharePoint
205737-image.png

and mapped the data to columns through update file properties
205746-image.png

but Im getting error in the date format.
205762-image.png

Please anyone help me to solve this issue.

I think there is error in the format of date,How to convert this into date format of sharepoint, Please help me to solve this issue

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
1,972 questions
No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruno Lucas 4,126 Reputation points MVP
    2022-05-26T08:52:53.5+00:00

    Hi @Ananya Dixith ,

    I would need to know the value you are passing, I see you are using compose. you may need to add some cast script overthere like:
    https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#parsedatetime

    205804-image.png

    without that I get the same error passing something like a date in another language

    205784-image.png

    for the error above I passed this value

    205805-image.png

    and fixed with this script. If you can share your date format I can suggest a script

    205841-image.png

    If your date has an unusual format you may need to split the parts, reassemble in a way the "formatDateTime" would understand

    On your case "21-09-12" you need to split in 3 parts using the "-" as a delimiter:

    formatDateTime(concat(split(triggerBody()?['date'], '-')2,'-',split(triggerBody()?['date'], '-')1,'-',split(triggerBody()?['date'], '-')[0]),'yyyy-MM-ddTHH:mm:ssZ')

    you can try to paste this into your compose:

    formatDateTime(concat(split(triggerBody()?['date'], '-')[2],'-',split(triggerBody()?['date'], '-')[1],'-',split(triggerBody()?['date'], '-')[0]),'yyyy-MM-ddTHH:mm:ssZ')  
    

    if it doesn't work straight away, try assembling it bit by bit

    starting with: split(triggerBody()?['date'], '-')2
    replace the triggerBody()?['date'] with your field, you can open a compose, switch to expression, enter split and fill the parameters until you manage to get that right

    your date has 3 parts separated by a dash "-"

    with a [0] in the split function, you get the first part of your date, the 21 in 21-09-12
    split(YOURINPUTDATEHERE, '-')[0]

    than add the concat('string1','string2','string3'), remembering you need to re-add the dashes and rearrange the parts to 2-1-0

    concat(split(YOURINPUTDATEHERE, '-')2,'-',split(YOURINPUTDATEHERE, '-')1,'-',split(YOURINPUTDATEHERE, '-')[0])

    and finally the formatDateTime: formatDateTime("string value here",'yyyy-MM-ddTHH:mm:ssZ')

    formatDateTime(concat(split(YOURINPUTDATEHERE, '-')2,'-',split((YOURINPUTDATEHERE, , '-')1,'-',split((YOURINPUTDATEHERE, , '-')[0]),'yyyy-MM-ddTHH:mm:ssZ')

    result:

    206278-image.png


  2. Kamlesh Kumar 3,771 Reputation points
    2022-05-26T13:31:55.29+00:00

    Hi @Ananya Dixith ,

    Thank you for asking this question on the Microsoft Q&A Platform.

    Yes you are correct, this error is coming because of wrong DataTime format and you have to format it before passing to next step. Could you please check what input you are passing in Invoice Date, and then format it accordingly.

    Created a simple LA with below DateTime format,

    formatDateTime(outputs('Compose'), 'yyyy-MM-ddTHH:mm:ss')  
    

    It will give you result like this, If you want the result in different format then please refer MS doc for more details,

    https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#formatDateTime

    205864-image.png

    Regards,
    Kamlesh Kumar
    BizTalk Techie

    Please don't forget to click on 205836-130616-image.png or upvote 205759-130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how

    Want a reminder to come back and check responses? Here is how to subscribe to a notification

    If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators