Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Xrm.Page.ui.formSelector navigate unexpected behavior

$
0
0

I need to navigate to another form depening on field value on change. But there are some problems. If I use Xrm.Utility.openEntityForm, then if I would press "Save and close", I would return to previous page, but it's not desirable behavior. 

If I use Xrm.Page.ui.formSelector navigate, it works properly on update, but if I create a new record, it would save, but navigate to creation new record, not created.

Code sample:

TypeChangedHandler: function () {
        var type = Xrm.Page.getAttribute(this.FieldNames.Type).getText();
        var typeValue = Xrm.Page.getAttribute(this.FieldNames.Type).getValue();
        var form = Xrm.Page.ui.formSelector.items.get(function (item) {
            return item.getLabel().search(type) !== -1
        });
        if (form.length === 0)
            return
        if (!Xrm.Page.data.getIsValid()) {
        Xrm.Page.getAttribute(GMCS.ConfigurationItem.FieldNames.Type).setValue(this.TypeOldValue)
            return
        }
        Xrm.Page.data.save().then(function () {
            GMCS.ConfigurationItem.TypeOldValue = Xrm.Page.getAttribute(GMCS.ConfigurationItem.FieldNames.Type).getValue();
            form[0].navigate()
        })

    },



Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>