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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

How to make Reason for Rejection dialog appear in custom Knowledge base form?

(1) ShareShare
ReportReport
Posted on by 112

I duplicated the default Form for KB articles to customize layout a bit and fields. However, the Reason for rejection slide out dialog is not triggered when changing the Review status to Rejected. It works in the Default form.

I've looked at events and triggers etc but cannot find where this functionality is to be able to replicate it. We also have 2 approval steps, so would like that to work there as well.

Screen-Shot-2022_2D00_03_2D00_02-at-10.09.22-AM.png

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Hi HangryMapache,

    I created a custom form as you did and it also not works for me.  Then I find the code in the library(msdyncrm_/KnowledgeManagement/KnowledgeArticle/KnowledgeArticleMainSystemLibrary.js) which is used to open this dialog. So I created an onchange event on Review field and hide the Review field on the form. And it could work for me now.

    Form Setting:

    7065.Snipaste_5F00_2022_2D00_03_2D00_11_5F00_16_2D00_30_2D00_04.png

    Onchange code:

    function onchange(eventContext) {
    alert(1);
    var formContext = KnowledgeManagement.KnowledgeArticleUtility.getFormContext(eventContext),
    reviewState = formContext.data.entity.attributes.get(KnowledgeManagement.Review),reviewOptionSetPreviousSelection=null;
    if (reviewState.getValue() == KnowledgeManagement.KnowledgeArticleReviewState.Rejected) {
    var primaryAuthorLookupAttribute = formContext.getAttribute(KnowledgeManagement.PrimaryAuthorId),
    guidForPrimaryAuthorId = "";
    if (primaryAuthorLookupAttribute) {
    var primaryAuthorLookupAttributeValue = primaryAuthorLookupAttribute.getValue();
    if (primaryAuthorLookupAttributeValue && primaryAuthorLookupAttributeValue.length > 0) guidForPrimaryAuthorId = primaryAuthorLookupAttributeValue[0].id
    }
    var options = {
    height: 500,
    width: 400,
    position: 2
    },
    dialogParams = {};
    dialogParams[KnowledgeManagement.ParamEntityId] = formContext.data.entity.getId();
    dialogParams[KnowledgeManagement.ParamLastButtonClicked] = KnowledgeManagement.DialogOkId;
    dialogParams[KnowledgeManagement.ParamPrimaryAuthorId] = guidForPrimaryAuthorId;
    dialogParams[KnowledgeManagement.ParamReview] = reviewState.getValue();
    Xrm.Navigation.openDialog(KnowledgeManagement.RejectKnowledgeArticleDialog, options, dialogParams).then(function(successParameter) {
    var reviewState = formContext.getAttribute(KnowledgeManagement.Review);
    if (reviewState)
    if (successParameter.parameters[KnowledgeManagement.ParamLastButtonClicked] == KnowledgeManagement.DialogOkId) reviewOptionSetPreviousSelection = reviewState.getValue();
    else reviewState.setValue(reviewOptionSetPreviousSelection)
    }, null)
    } else if (reviewState.getValue() == KnowledgeManagement.KnowledgeArticleReviewState.Approved) {
    var onApproveDialogCancelCallback = function() {
    var reviewOptionSet = reviewState;
    reviewOptionSet.setValue(reviewOptionSetPreviousSelection)
    },
    onApproveDialogOkCallback = function(response) {
    var reviewOptionSet = reviewState;
    reviewOptionSetPreviousSelection = reviewOptionSet.getValue()
    };
    KnowledgeManagement.KnowledgeArticle.CommandActions.approveArticle(formContext, onApproveDialogOkCallback, onApproveDialogCancelCallback)
    } else reviewOptionSetPreviousSelection = reviewState.getValue()
    };

    Result:

    kb.gif

  • JustRhonda Profile Picture
    99 on at
    I'm glad someone had the same question I did. I don't like the answer (not low-code) but at least I know it isn't a simple solution. I can't even find the library when I search the Default Solution Web Resources. 

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 > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 55 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 25 Most Valuable Professional

#3
Soundari Profile Picture

Soundari 15

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans