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, ...
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:
 
  • Mohit Rampal Profile Picture
    12,573 Moderator on at
    public void insert()
    {
        super();
    
        HcmWorker::flushCurrentWorker();
    }  
    Note: Testing with above code if Insert Code Snippet button works correctly
     
  • Mohit Rampal Profile Picture
    12,573 Moderator on at
    Its working, so you can use 'Insert Code Snippet' button.
  • Martin Dráb Profile Picture
    240,793 Most Valuable Professional on at
    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
    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
    [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
    240,793 Most Valuable Professional on at
    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
    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 430 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 368

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 364 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans