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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to assign null value to string parameter using contract class

(1) ShareShare
ReportReport
Posted on by 3,045
Hi All,
 
I have created contract class which consist string parm method. I am using this contract class for JSON searilization and then passing data to third party application. As per the requirement all the blank string values should be assign null value and json output should be like:
 
{
/name/: null
 
I have tried passing null value to method in the case output is coming like as below:
{
/name/:/ /
}
 
Please guide how I can achieve this. Thanks. 
I have the same question (0)
  • Suggested answer
    Waed Ayyad Profile Picture
    9,090 Super User 2026 Season 1 on at
    Hi,
     
    Try the below code:
    static void Job5(Args _args) 
    { 
        System.String nullStr; 
        nullStr = CLRInterop::Null("System.String"); 
        print CLRInterop::isInitialized(nullStr); 
        print CLRInterop::isNull(nullStr); 
    }
    Based on this document:
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
  • Pooja Karki Profile Picture
    3,045 on at
    I have tried below line and it is returning blank output.
     
    CLRInterop::Null("System.String");
  • Suggested answer
    Waed Ayyad Profile Picture
    9,090 Super User 2026 Season 1 on at
    Hi,
     
    Did you try to set the string with "null", give it a try and tell us the result.
     
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
  • Pooja Karki Profile Picture
    3,045 on at
    Yes, I have tried passing value like:
     
    classname.methodname(CLRInterop::Null("Null"));
     
    in this case it is returning blank value.
  • Martin Dráb Profile Picture
    239,057 Most Valuable Professional on at
    If your methodname() method accepts str type and the backing variable is str too, it can't store null values. I don't know whether changing it to System.String will work, but it definitely can't work with str.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 676

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 462 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 335 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans