BPF Filtered lookup field not working in certain stages



  • In my case same lookup field in BPF for two more stages in a process which is working in stage1 and not working in stage2 and stage3.

     function Filter(executionContext) {
        debugger;
        var formContext = executionContext.getFormContext();
        var control = Xrm.Page.getControl("header_process_attributename");
        if (control) {       
            formContext.getControl("header_process_new_attributename").setDefaultView("{**View Guid**}");
    
        }
    }
    
    


  • It is working by using following code:

    Need to change attribute name as follows

    Stage 2:

    var control = Xrm.Page.getControl("header_process_attributename_1");
    
    

    Stage 3:

    var control = Xrm.Page.getControl("header_process_attributename_2");
    
    


  • formcontext.getattributes().controls.forEach(function (control) {
        if (control && control.addCustomView) {
            var viewId = "{65FFAF9A-E8C5-432D-860B-32F841B00D87}"; //All Accounts
            var entityName = 'account';
            var viewDisplayName = 'ShipTo Accounts';
            control.addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
        }
    }); 
    
    

    There can be 2 issues here

    1. When we wish to work with same lookup field perhaps name of that lookup field on next stage is header_process_attributename2
    2. It can also happen that you do not get control of that field because of load issue.

    In this case I would suggest you take all the controls on form and then iterate over them to get correct controls.

    Code snippet above



最新帖子

最新内容

  • S

    I am getting input from checkbox values in array using bootstrap form. I am using array for storing checkbox values. How i convert this array to string . Because database only take string values.

    Here is my code

    <div class="form-group col-md-12"> <div class="custom-control custom-checkbox custom-control-inline"> <input type="checkbox" id="eduPrimary" name="education[]" class="custom-control-input" value="primary" /> <label class="custom-control-label" for="eduPrimary">primary</label> </div> </div> <div class="form-group col-md-12"> <div class="custom-control custom-checkbox custom-control-inline"> <input type="checkbox" id="eduSecondary" name="education[]" class="custom-control-input" value="secondary" /> <label class="custom-control-label" for="eduSecondary">secondary</label> </div> </div> <div class="form-group col-md-12"> <div class="custom-control custom-checkbox custom-control-inline"> <input type="checkbox" id="eduUniversity" name="education[]" class="custom-control-input" value="university" /> <label class="custom-control-label"for="eduUniversity">university</label> </div> </div>

    In backend i am using laravel to store values to database But it run error that storing array to string in mysql.

    public function store(Request $request,AdProfile $adprofile) { $adprofile->education = $request->education[]; $adprofile->save(); return redirect()->route('adprofile.profilecomplete'); }

    read more
  • S

    I am trying to deploy a multi language angular (6) app (I am using nginx-translate like this {{'aboutus'| translate}} ). I can run and test my app using (ng serve) but when I deployed my app and tried to test it on IIS it didn't work. I also tested the angular tour of heroes (toh) app and I was able to deploy and test it on IIS successfully. I think there might be a trick or some thing that I don't know. any suggestion ?

    read more
  • S
    document.onkeydown = function(evt){ evt = evt || window.event; if(evt.shiftKey && evt.key == "F8"){ } };

    read more
  • S

    On any modern browser, you can use a keydown or keyup event handler like this one:

    document.addEventListener("keydown", function(e) { if (e.key === "F8" && e.shiftKey) { e.preventDefault(); // ...Shift+F8 was pressed... } });

    or with jQuery:

    $(document).on("keydown", function(e) { if (e.key === "F8" && e.shiftKey) { e.preventDefault(); // ...Shift+F8 was pressed... } });

    Whether that works may be browser-specific, because different browsers reserve different key combinations. It works on Chrome and Firefox on my copy of Linux, and on Edge on Windows 10, and IE11 on Windows 8. Note that you have to click inside the window to ensure it has focus.

    You've tagged internet-explorer-8. If you really need to support that truly obsolete browser, which doesn't have addEventListener, use a version of jQuery that still supports IE8 (or the hookEvent function from this answer, which works on IE8 [or even IE6]) and then instead of using e.key, use e.which || e.keyCode and the appropriate keycode. The reason we have e.key now is that "the appropriate keycode" varies by keyboard layout. On my keyboard, F8 is 119, so:

    // For obsolete browsers without `addEventListener` hookEvent(document, "keydown", function(e) { if ((e.which || e.keyCode) === 119 && e.shiftKey) { e.preventDefault(); // ...Shift+F8 was pressed... } });

    or using an older version of jQuery that supports IE8:

    // For obsolete browsers $(document).on("keydown", function(e) { // ^---- if it's a REALLY old version, you might need `bind` instead of `on` if ((e.which || e.keyCode) === 119 && e.shiftKey) { e.preventDefault(); // ...Shift+F8 was pressed... } });

    read more
  • S

    I am trying to capture Shift+F8 in my JQuery application & want it to propagate down. I have read many posts but somehow I am not able to catch Shift+F8 key at all. I found 1 useful lib here but it is able to find 'Shift+F2/F3/...' but not 'Shift+F8' particularly. any suggestions please & thanks in advance.

    Environment : Windows & IE (11 & 😎

    read more

推荐阅读

  • 2
  • 1
  • 2
  • 1
  • 3
  • 2
  • 3
  • 2