Alexander Bautz

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 3,752 total)
  • Author
    Posts
  • in reply to: spjs utility / add item #32884
    Alexander Bautz
    Keymaster

    I’m not sure I understand how you want to create the child item – using the normal NewForm and pull values from the parameters in the URL or using code in the parent to create it.

    I’ll start by showing how to do this programmatically from the parent item.

    spjs.utility.addItem({
        "listName":"Your_Child_List_GUID_Or_DisplayName",
        "data": {
            "Title": "New item created with code", 
            "ContentTypeId": "0x0100",
            "Parent_Item_lookup_field": getFieldValue("ID")
        }
    });

    Change the snippet and add your child list GUID or display name and your parent item lookup field name.

    The content type “Item” has id “0x0100” and the “Task” has id “0x0108”. You find the id by looking at the URL when you try adding a new item in the child list using the specific content type.

    Alexander

    in reply to: Cascading Dropdowns DataSheet View #32878
    Alexander Bautz
    Keymaster

    Sorry, but it is not possible to add support for this in datasheet view.

    Alexander

    in reply to: Is equal to and changed from initial value operator #32871
    Alexander Bautz
    Keymaster

    Good idea – I’ll see what I can do in a future release.

    Alexander

    in reply to: Is equal to and changed from initial value operator #32861
    Alexander Bautz
    Keymaster

    You can do this by using two rules. The first one is using the “is changed from initial value” and does not have any “actions”.

    The second one uses the “if field equals” and then has the name of the first rule in the “Linked rules and functions” textarea. This rule has the send email action.

    Now the second rule will only evaluate to true if both rules are true.

    Let me know how this works out.

    Alexander

    in reply to: spjs.utility.addItem creating 2 entries when called #32852
    Alexander Bautz
    Keymaster

    I had a look at my code and the dffs_PreSaveAction will fire two times. If it passes all custom code when you click save, it must exit the function to process emails and will then retrigger save when emails have been sent (obviously sending them after the item has been saved would be better, but because DFFS does not handle the save itself it is hard to do this after it is saved).

    I’ll look into skipping the dffs_PreSaveAction function entirely when it returns to save after processing the emails.

    Alexander

    in reply to: General DFFS enhancement suggestions #32850
    Alexander Bautz
    Keymaster

    Thanks for the excellent suggestion! – I’ll add it to the next release.

    PS: To keep backwards compatibility with IE (yes, still in use unfortunately) I had to rewrite the => syntax.

    Best regards,
    Alexander

    in reply to: spjs.utility.addItem creating 2 entries when called #32833
    Alexander Bautz
    Keymaster

    Hi,
    Not sure what could be causing this issue. Try adding a line with the text debugger; at the top of the dffs_PreSaveAction function to have it pause in the developer tools so you can see if it is actually triggering two times.

    It could be an issue with how the save is handled when using DFFS email – if it does trigger two times you can modify it like this:

    var listItemCreated = false;
    function dffs_PreSaveAction(){
        if (!readyToCreateRecordInTrainingEvents) { return true; }
        if(listItemCreated){
            return true;
        }
        ...
        ...
        ...
        if (resp.success)  {
            newRecordId = resp.id;
            newRecordLink = "https://intranet.ltp.org/training-and-events/Lists/TrainingEvents/DispForm.aspx?ID=" + newRecordId;
            listItemCreated = true;
            return true;
        } else {
        ...
        ...
        ...

    Alexander

    in reply to: SPJS-CASC Filter Options #32826
    Alexander Bautz
    Keymaster

    The code I send is for Custom CSS and not Custom JS.

    Replace vLookupTasks with the internal name of your vLookup field – you find the internal name in the Fields tab in your DFFS config.

    Alexander

    in reply to: DFFS_Email List at site collection level #32818
    Alexander Bautz
    Keymaster

    I have posted a new version – look at the changelog to see how you can change the DFFS_Email list location: https://spjsblog.com/2021/02/21/dffs-package-updated-to-v4-4-5-17/

    Alexander

    in reply to: SPJS-CASC Filter Options #32808
    Alexander Bautz
    Keymaster

    I have not added a class to the header that you can address directly, but you can do it like this (change vLookupTasks for your vLookup field name):

    /* Hide header - the number 6 is the count of columns from left*/
    #vLookupTablePlaceholder_vLookupTasks tr .childTableHeader:nth-child(6){
    }
    
    /* Hide body - change vLookupTasks for your vLookup field name and vLookupTasks_Status to match your vLookup field name and the child list field internal name separated with _  */
    #vLookupTablePlaceholder_vLookupTasks .vLookupTasks_Status{
        display:none;
    }

    Alexander

    in reply to: DFFS_Email List at site collection level #32807
    Alexander Bautz
    Keymaster

    Hi,
    This is currently not possible, but easy to do so I’ll add an option to specify the path to the site where the DFFS_Email list is in the next version.

    Alexander

    in reply to: vLookup Not Populating in List when paging in web part #32797
    Alexander Bautz
    Keymaster

    If you use that field name on both lists you can try changing the vLookup field name on one of them. Just create a new field named for example vLookup_Children2 and go to the vLookup config tab and export from the old and import to the new field – then delete the old field (existing child items are not affected by this).

    Alexander

    Alexander Bautz
    Keymaster

    Hi,
    Just add this to the bottom of the parseRackCombo function:

    // Concatenate only Title and SerialNo
    setFieldValue("AnotherField", title + " - " + serialNo);

    Alexander

    in reply to: Use SP details for word doc #32777
    Alexander Bautz
    Keymaster

    You can try this – I have written it freehand and have not tested it so it might need some more tweaking:

    // Find the document ID
    var doc = spjs.utility.queryItems({
        "listName": "YOUR_DOC_LIB_DISPLAY_NAME_OR_GUID",
        "query": "<Where><Eq><FieldRef Name='FileLeafRef' /><Value Type='Text'>The_document_name.docx</Value></Eq></Where>",
        "viewFields": ["ID"]
    });
    if (doc.count > 0) {
        // Found the document - update the metadata
        var res = spjs.utility.updateItem({
            "listName": "YOUR_DOC_LIB_DISPLAY_NAME_OR_GUID",
            "id": doc.items[0].ID,
            "data": {
                "Title": "The value in the title field",
                "Another_field": "The value"
            }
        });
        if (res.success) {
            // Item updated
        } else {
            alert(res.errorText);
        }
    }

    Replace YOUR_DOC_LIB_DISPLAY_NAME_OR_GUID, The_document_name.docx and the field internal names and values in the data parameter of the spjs.utility.updateItem function call.

    Alexander

    in reply to: Use SP details for word doc #32773
    Alexander Bautz
    Keymaster

    The quick parts work both ways, but the SharePoint form you fill them into must be the properties-form for an existing file – if you do, they will show when you open the document.

    Not sure exactly what you are trying to do, but if the document exists you can use custom code to write the properties to the documents properties before opening it.

    If this document have been created from a template that has the quick parts set up (for example in the document header) – your properties will now show in the document.

    Alexander

Viewing 15 posts - 1 through 15 (of 3,752 total)