Auto assign related items with Safari

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Alex
Posts: 32
Joined: Fri Jun 30, 2017

13 Aug 2018

I have issues to "auto assign" related items to a parent item using Safari.

The child item form is opening as a Pop Up over the parent item. The related pop up stays empty.

Any ideas what to consider using Safari?

regards
Alex

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

13 Aug 2018

Dear Alex,
Not sure if there is an issue with Safari specifically, but when you create Child from the New Form - there is no way to populate Parent Field directly (there is no ID yet), so it populates hidden field instead, and then during saving it will link the items together.

Here's a video example - https://www.youtube.com/watch?v=rd8g6Zu1H_E
Cheers

Alex
Posts: 32
Joined: Fri Jun 30, 2017

13 Aug 2018

Hi Nikita,

the parent item is already there. I'm trying to create an new child item from the parent "View" form.

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

13 Aug 2018

Dear Alex,
Are you sure the issue is with the Safari browser? Does it work with Google Chrome for example?
Cheers

Alex
Posts: 32
Joined: Fri Jun 30, 2017

13 Aug 2018

Yes, I tested it on Win10 with Edge, Chrome, Opera and Firefox
Even on MAC it is working well with Firefox....

Seems that Safari has an issue with it.

Alex
Posts: 32
Joined: Fri Jun 30, 2017

14 Aug 2018

@Nikita were you able to reproduce it?

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

14 Aug 2018

Dear Alex,
Unfortunately not. Can you, please, try to open the Edit form in Safari, try to add an item, and open browser's console? There should be an error related to the problem, please, send us a screenshot of the error, if it is there.
Cheers

Alex
Posts: 32
Joined: Fri Jun 30, 2017

20 Aug 2018

Hi Nikita,
I tried display form and edit form, there is only sometimes a error on the edit form (see 2nd screen shot).

any ideas?
It would be possible to create a similar site for you, probably would be more helpful?

br, Alex
Attachments
Screen Shot 2018-08-20 at 09.40.39.png
error msg
Screen Shot 2018-08-20 at 09.40.39.png (197.27 KiB) Viewed 1992 times
Screen Shot 2018-08-20 at 09.29.34.png
site with console
Screen Shot 2018-08-20 at 09.29.34.png (217.37 KiB) Viewed 1992 times

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

20 Aug 2018

Hi Alex,
Could you provide your code from the child form?

Alex
Posts: 32
Joined: Fri Jun 30, 2017

21 Aug 2018

Hi Dmitry,
yes, I have this inside the JavaScript Editor

Code: Select all

if (window != window.top && window.top.fd) {
    // the form is opened in a dialog from the parent form
    var parentId = window.top.GetUrlKeyValue('ID');
    if (parentId) {
        // the form is opened from the Edit form
        fd.field('AssignedTicket').value(parentId);
    } else {
        // the form is opened from the New form
        $('#_fd_parent_temp > input').val(window.top.fd._tempParentId());
    }
     
    $('.parent-ticket').hide();
}
and additional JS code via linked script:

Code: Select all

if (typeof jQuery == "undefined") {
    jQuery = Plumsail.FD.jQuery;
}
window.TicketPartnerID = ((_spPageContextInfo.webAbsoluteUrl).replace(_spPageContextInfo.siteAbsoluteUrl, "")).replace(/\D/g, '');
var success = false;
jQuery(document).ready(function () {
    fd.onsubmit(function () {
        var postURL = "https://prod-16.westeurope.logic.azure.com:443/workflows/xxxxxxxxxx/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=yyyyyyyyyyyyy";
        var data = JSON.parse('{"partnerID":"' + parseInt(window.TicketPartnerID) + '","ticketID":"' + window.top.GetUrlKeyValue('ID') + '","title":"' + fd.field("Title").value() + '","author":"' + _spPageContextInfo.userDisplayName + '","userId":"'+_spPageContextInfo.userId+'"}');
        if (!success) {
            jQuery.ajax({
                url: postURL,
                method: "POST",
                headers: {
                    "Accept": "application/json",
                    "Content-Type": "application/json"
                },
                data: JSON.stringify(data),
                success: function () {
                    console.log("azure call successful.");
                    success = true;
                    fd.save().click();
                }
            });
        }
        if (success) {
            return true;
        }

        return false;
    });

});

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 22 guests