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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

How to post code in dynamics community in a proper format

(0) ShareShare
ReportReport
Posted on by 1,552
Hi,
 
When i post code in dynamics community it appears in a wrong format. How to make it appear properly.
 
For example i posted this question, before clicking post it was in a good format then it appeared in one line like this link:
 
I have the same question (0)
  • Mohit Rampal Profile Picture
    12,565 Moderator on at
    How to post code in dynamics community in a proper format
    public void insert()
    {
        super();
    
        HcmWorker::flushCurrentWorker();
    }  
    Note: Testing with above code if Insert Code Snippet button works correctly
     
  • Mohit Rampal Profile Picture
    12,565 Moderator on at
    How to post code in dynamics community in a proper format
    Its working, so you can use 'Insert Code Snippet' button.
  • Martin Dráb Profile Picture
    237,681 Most Valuable Professional on at
    How to post code in dynamics community in a proper format
    What I do is pressing Insert Code Snippet (the second button from the right in the toolbar; it doesn't seem to have any icon) and simply putting code there.
    try
    {
        info("abc");
    }
    Edit: Mohit was faster. But the difference is that I don't see the icon (the button works for me too).
  • junior AX Profile Picture
    1,552 on at
    How to post code in dynamics community in a proper format
    I did this:

    ​[DataContractAttribute]
     class Contract1
    {
        str                                    callerName;
        
        public str parmCallerName(str _callerName = callerName)
        {
            callerName = _callerName;
            return callerName;
        }
    }
    
    ​
     
  • junior AX Profile Picture
    1,552 on at
    How to post code in dynamics community in a proper format
    [DataContractAttribute] 
    class Contract1
    {   str callerName;
        str packedQuery;
        str ContainerStr;
        
        public str parmCallerName(str _callerName = callerName) 
        {   callerName = _callerName;
            return callerName;
        } 
        
        public str containerStr(str _containerStr = containerStr)
        { 
            containerStr = _containerStr;
            return containerStr;
        } 
        
        [ DataMemberAttribute, 
        AifQueryTypeAttribute('_packedQuery', queryStr(Query1))] 
        
        public str parmQuery(str _packedQuery = packedQuery)
        {   
            packedQuery = _packedQuery;
            return packedQuery;
        } 
    
        public void setQuery(Query _query)
        { 
            packedQuery = SysOperationHelper :: base64Encode(_query.pack());
        } 
        
        public Query getQuery() 
        { 
            return new Query(SysOperationHelper :: base64Decode(packedQuery));
        }
        
    }
        
    This one is not working

    ​​​​​​​
    [DataContractAttribute] 
    class Contract1
    {   str callerName;
        str packedQuery;
        str ContainerStr;
        
        public str parmCallerName(str _callerName = callerName) 
        {   callerName = _callerName;
            return callerName;
        } 
        
        public str containerStr(str _containerStr = containerStr)
        { 
            containerStr = _containerStr;
            return containerStr;
        } 
        
        [ DataMemberAttribute, 
        AifQueryTypeAttribute('_packedQuery', queryStr(Query1))] 
        
        public str parmQuery(str _packedQuery = packedQuery)
        {   
            packedQuery = _packedQuery;
            return packedQuery;
        } 
        public void setQuery(Query _query)
        { 
            packedQuery = SysOperationHelper :: base64Encode(_query.pack());
        } 
        
        public Query getQuery() 
        { 
            return new Query(SysOperationHelper :: base64Decode(packedQuery));
        }
        
    }
        

  • Martin Dráb Profile Picture
    237,681 Most Valuable Professional on at
    How to post code in dynamics community in a proper format
    I'm sorry, but we can't review your steps regarding "This one is not working", because you didn't mention them. If you need our help, please provide this information.
     
    Otherwise I'm assuming that you now know how to use Insert Code Snippet and this thread can be closed.
  • junior AX Profile Picture
    1,552 on at
    How to post code in dynamics community in a proper format
    Hi Martin,

    I had to post something to see if it's working.

    I'm not sure why the question appears wrongly. Maybe it only works in answers

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 563 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans