I'm fairly new to Dynamics Web Resources and with our web developers help I've written 1 to show a DOMO report in an iFrame. Now, I would like to tackle putting a link on a contact record that will pop a new window and allow the user to fill out a custom form that our third party app builder has built. This form can be accessed if I know the user id and the contact id for which I need to take the action on.
Normally a user will click a link inside of an iframe on a contact form and this new window will pop up a web form and they can create what we call a Sales Opportunity. When clicking this link and filling out the form, the form can complete multiple functions. 1. Create a phone call record. 2. Create a sales opportunity. 3. Update the Contact.
I want the link to be in a text URL field so that it can be clicked from an entity view. When the window pops, it pops with the user id and the contact id already in the form and the user can then quickly record the details of the opportunity and phone call.
I've taken the code from another web resource our partner developed and have tried to edit it to fit what I would like, but obviously it's not working (just a blank page).
Is it possible to populate the URL of the web resource in the URL Field on a record and then have that URL pop the custom form with the user and the contact pre-populated?
Here's my current code (that doesn't work): `
<title>Activity</title>
<script src="../../../../ClientGlobalContext.js.aspx" type="text/javascript"></script>
<script src="../../../scripts/jquery.min.js" type="text/javascript"></script>
<script src="../../../scripts/crmhelper.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
var id = window.top.opener.Xrm.Page.data.entity.getId();
Crm.retrieveRecord(id, "ContactSet", successCallback);
});
function successCallback(data, status, request) {
var cId = window.top.opener.Xrm.Page.data.entity.getId();
var user = window.top.opener.Xrm.Page.context.getUserId();
var org = Crm.getServerOnlineOrganization();
var cId2 = = cId.replace(/{|}/g, '');
var url = "https://mycrmurl.com/mscrm/ticketing/Activity/PhoneCallSave.aspx?cId=" + cId2 + "&id=" + cId + "&orgname=" + org + "&userid=" + user + "&token=XYX4RXWf";
$('#iframe1').attr('src', url);
}
</script>
<style type="text/css">
html, body {
overflow: hidden;
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
}
iframe {
width: 100%;
height: 100%;
border: 0px;
}
</style>
<iframe id="iframe1" frameborder="0" noresize="noresize"></iframe>
`