Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Create autopost with hyperlink through plugin

Posted on by 570

Hi,

I have a requirement to create auto post with username hyperlink. I need to do it through plugin not OOB workflow.

I could create a post as below

Entity objPost=new Entity("post");

objPost["text"]="some text";

objPost["regardingobjectid"]=new EntityReference("contact",id);

objPost["source"]=new OptionSetValue(1);

service.Create(objPost);

But in text field I should need to show Loggedin username with hyperlink to user record. When I click on the username it should open the user record.

Is it possible to do the hyperlinks in text field from plugin?

Thanks

Bala

*This post is locked for comments

  • Suggested answer
    tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: Create autopost with hyperlink through plugin

    Hi,

    Why don't you just create a post in context of the user that you want (you have something like:

    IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));            

    var service = factory.CreateOrganizationService(this.PluginExecutionContext.UserId);)

    but for that "UserId" you can put whatever userId you want (if the plugin is running on System Admin user).

    After you do that, the post would be created in context of the user, so the user will be displayed as creator of the post and you would be able to click on this username and go to the user record.

    I did not test this myself, but I think it should work

  • Suggested answer
    PS Profile Picture
    PS 23,577 on at
    RE: Create autopost with hyperlink through plugin

    See if it helps: unleashingcrm.wordpress.com/.../hyperlink-in-plugins

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans