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

Dynamics 365 9.1 on-premise - sporadic 'no documents found' on documents iframe when having stagetabs js running

$
0
0

Hey all,

we are running Dynamics 365 9.1 on-premise and are experiencing the following issue:

There's a form where we have hide/show section based on bpf stage. On one section there's a SharePoint document iframe implemented after common known best practise.

So far so good...

Once the form is saved in customizing and opened, the document iframe shows files and folder just as they are created:

But after some refreshes of the page or after trying to open the page after a few minues, the documet iframe says that there are no documents found (even though there are some...):

I have figured out that this issue only happens when we use the hide/show js, so I assume there must be the issue.

Here's the js:

function documentSubgrid()
{   
var recordId = Xrm.Page.data.entity.getId().replace(/[{}]/g, "");
var iFrame = Xrm.Page.getControl("IFRAME_Firma_SharePoint_Test");
var currentFormId = Xrm.Page.ui.formSelector.getCurrentItem().getId();
var oTypeCode = Xrm.Page.context.getQueryStringParameters().etc;
if (iFrame != null)
    {

var url = Xrm.Page.context.getClientUrl() + "/userdefined/areas.aspx?formid=" + currentFormId + "&inlineEdit=1&navItemName=Documents&oId=%7b" + recordId + "%7d&oType=" + oTypeCode + "&rof=true&security=852023&tabSet=areaSPDocuments&theme=Outlook15White";

        Xrm.Page.getControl("IFRAME_Firma_SharePoint_Test").setSrc(url);
    }
}


var stages = null;

function Form_OnLoad()
{
    Xrm.Page.data.process.addOnStageSelected(OnStageSelected);
    Xrm.Page.data.process.addOnStageChange(OnStageChanged);

    if (Xrm.Page.data.process != null)
    {
        if(Xrm.Page.data.process.getActiveProcess())
        {
            stages = Xrm.Page.data.process.getActiveProcess().getStages();
    
            OnStageChanged();    
        }
        
    }
}


function StageTabsLoop(stage, index)
{
    if(typeof stagetabs[stage.getName()] !== 'undefined')
    {
        if(stagetabs[stage.getName()].length > 0)
        {
            for (var j = 0; j < stagetabs[stage.getName()].length; j++) 
                { 
                            if(Xrm.Page.ui.tabs.get(stagetabs[stage.getName()][j]))
                            {
                                        Xrm.Page.ui.tabs.get(stagetabs[stage.getName()][j]).setVisible(false); 
                            }
                }    
        }    
    }
}

function OnStageSelected(state) 
{
            var eventAgrs = state.getEventArgs(); 
            var selectedStage = eventAgrs.getStage();  stages.forEach(StageTabsLoop); 
            var selectedStage = selectedStage.getName(); 
            for (var i = 0; i < stagetabs[selectedStage].length; i++) { Xrm.Page.ui.tabs.get(stagetabs[selectedStage][i]).setVisible(true); } 
}


function OnStageChanged() 
{ 
            stages.forEach(StageTabsLoop); 
            var activeStage = Xrm.Page.data.process.getActiveStage().getName(); 
            for (var i = 0; i < stagetabs[activeStage].length; i++) { Xrm.Page.ui.tabs.get(stagetabs[activeStage][i]).setVisible(true); } 
}

var stagetabs = new Array();
stagetabs["Informationen"] = ["Informationen"]
stagetabs["Fragebogen - Allgemeines"] = ["Fragebogen - Allgemeines"];
stagetabs["Fragebogen - Zielgruppe"] = ["Fragebogen - Zielgruppe"];
stagetabs["Fragebogen - Seiteninhalte"] = ["Fragebogen - Seiteninhalte"];
stagetabs["Uploads"] = ["Uploads"];
stagetabs["Abschluss & Phasenwechsel"] = ["Abschluss & Phasenwechsel"];

Does any one of you have an idea what could be done to fix this :-)?

Thanks in advance and best wishes


Viewing all articles
Browse latest Browse all 46379

Trending Articles



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