Office-js-docs-pr: @customfunction id property

Created on 22 May 2019  Â·  8Comments  Â·  Source: OfficeDev/office-js-docs-pr

Documentation says:

The characters allowed are limited to: A-Z, a-z, 0-9, and period (.).

However, I am able to use underscore for the id property, just like the name.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Excel doc bug

All 8 comments

@smozgur thanks for the feedback! We'll look into this and update the docs accordingly.

(@mscharlock can you please look into this when you have a chance? Thanks!)

Yep, will do!

@smozgur are you seeing an underscore allowed in Script Lab or on a project that is up and running? Script Lab does not have complete parity with the registration mechanism used by custom functions, so it allows _s while regular custom functions projects do not. I'm working to file a bug (and figure out which one engineering actually wants) but wanted to update you and ask.

@mscharlock, both of them.
As a sample, following function works in custom Office add-in as well as Script Lab:

/**
 * Calculates the average of two numbers
 * @customfunction AVERAGE_1
 * @param {number} first_number First number
 * @param {number} second_number Second number
 * @returns {number} The average of the two numbers.
 */
function average (first_number, second_number) {
    return (first_number + second_number) / 2;
}
CustomFunctions.associate("AVERAGE_1", average)

Metadata is successfully generated as same for both.

Actually I am not sure if it should be considered as a bug. I would expect underscore is accepted by the id. That's why I tested a custom function with underscore in the first place actually.

Awesome, thanks for letting me know. I'll be able to get back to you once @keyur32 is back in the office (should be Tuesday). :)

Ok, I got some clarity from people. Turns out underscores are supposed to be allowed in both id and name. I'll have a fix out here shortly! Thanks for reporting this issue. :)

Going to go ahead and close this issue now that a fix has been implemented in the docs - thanks again for the suggestion @smozgur! Feel free to leave a comment to the issue if you need any further assistance, but I'll close for now!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peteshub picture peteshub  Â·  7Comments

bilalchraibi picture bilalchraibi  Â·  4Comments

hyoshioka0128 picture hyoshioka0128  Â·  6Comments

Scheel picture Scheel  Â·  4Comments

PramodKumarYadav picture PramodKumarYadav  Â·  3Comments