web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / retaining leading zero...
Power Apps
Answered

retaining leading zero in duns number

(0) ShareShare
ReportReport
Posted on by 7

Hi all,

 

https://www.youtube.com/watch?v=XrWcPgEtxdo

 

Followed the above tutorial to learn a little bit about custom connectors and APIs. Ran into a huge problem with the custom connector dropping the leading zero in the API Request URL.   I am really not sure what to do about this issue.  It pretty much renders this or other Power app with a Leading Zero as a parameter useless.

 

How would one keep the leading zero when it is being added to a URL?  Is this a a 'bigger' issue with Microsoft products?

 

Actions taken so far:

Adjusted the concatenate Variables to return as plaintext instead of the Value type. They are coming back with the leading Zero.

 

Set(varDunNumber, PlainText(Concatenate(tblCompanyList.Selected.duns, tblCompanyList.Selected.duns_plus4)));
Set(varCompanyResult, SAM.FindCompany(varDunNumber).sam_data.registration)

 

the formula bar  shows carDunNumber = 0814668490000 [Image attached]

 

I have changed the source json to a string not a integer 'int32'.  (no affect).  Made the change in the 'Changed the Definition's Request Path Parameter Type ' while creating the custom connector.

 

Opened the Power App Monitor to troubleshoot 

 

Request being sent changes the SAM.FindCompany API call request URL to below.  Now the leading Zero is missing.

 

Response come back with an error
 
"body": {
"Message": "Duns number must be 13 digit long",
"Error": "",
"Code": 406
2021-01-20_12-30-54.png
Categories:
I have the same question (0)
  • timl Profile Picture
    37,212 Super User 2026 Season 1 on at

    Hi @killnite618 

    It might help if you upload the json swagger/open api definition that you've used for your custom connector. Someone here might be able to spot the mistake.

    In essence, if you want to provide a value with leading zeros to your SAM.FindCompany method, the parameter for that must be defined as a string, rather than a number.

  • killnite618 Profile Picture
    7 on at

    Hi, 

     

    Attached are two files used

     

    • GSA-Sam.swagger.json = original github file
    • stringChangeGSA = modified file to help with the error

     

    Seems like the method is returning a string in the power app editor.  the Original post has a .png file showing what I see. 

  • Verified answer
    timl Profile Picture
    37,212 Super User 2026 Season 1 on at

    Hi @killnite618 

    I'm not sure, but this is the area that I would investigate. Assuming this relates to the method you're calling and you want it to accept a string with preceeding zeros, I would try changing this to a string.

     

    timl_0-1611239866797.png

     

  • killnite618 Profile Picture
    7 on at

    @timl 

     

    Did that in the stringChangeGSA file.

     

    I figured it out.  Although I updated the connector in the Custom Connectors it did not carry over to the power app. I removed the 'old' connection and reestablished it within the 'In your app' Data section  . 

     

    Seemed to clean up the leading zero bug. 

     

    Thank you for your help!

  • timl Profile Picture
    37,212 Super User 2026 Season 1 on at

    You're welcome @killnite618  - glad to help.

    It's probably useful to highlight for anyone reading this, how it's necessary to remove and to re-add the connection when we make these types of change.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard