Forum Replies Created
-
AuthorPosts
-
Hi Alex, I wanted to let you know about a behavior that I noticed regarding email. I have a rule that triggers when the form is saved. In that rule I send an email. The intent is to send the email after the form is submitted and link back to the item. So when a required field (for example) is not populated, the pre-save check stops the form submission and alerts the user that they need to populate the field and no email gets sent. This scenario works perfectly. However, if a people picker field or an ECT field does not resolve, the alert for that doesn’t happen until after the email gets sent. The form is not submitted, however the user gets an email that says it was submitted.
Is there any way to have the people picker checked at the same time that required fields are checked?
Thanks,
PennyIn your example for RTE fields, do you know what I would replace “#dffs_NameOfYourMultilineField div.ms-rtestate-write” with for an ECT field type?
If I can’t use the ECT field to trigger a rule, do you know how I can at least get the value out of it? when I try “getFieldValue(“FieldInternalName”) I get an error that says “unknown field type:SPFieldBusinessData”
Thanks for your help on this.
I have been able to view the ECT lookup fields on my display and edit forms using the following code:
function getItemAdditionalField() {var ids = $("span.getItemAdditionalField") .map(function() {return this.id;}).get(); var qRes = spjs.utility.getItemByID({ "listName": _spPageContextInfo.pageListId, "id": spjs.dffs.data.thisItemID, "viewFields": ids }); $.each(qRes, function(key, value) { $("span.getItemAdditionalField#" + key).html(value); }); }
<span class="getItemAdditionalField" id="FieldInternalName" />
However, I have noticed some odd behavior regarding the ECT primary field which holds the lookup value. In the edit form, When I try to create a rule with the trigger “this ECT field changes” the field itself is not available in the list of fields. (The field type is SPFieldBusinessData).
The other quirky thing is that the ECT primary field IS available to set as required using a rule, however even if I set it as required, the form will still save and close even if it is not populated. Are there different properties with ECT fields that could cause this behavior?Thanks!
I have attempted to add them to my display form (they all appear to be in the list of fields to add to a tab), however after saving the configuration and viewing the display form, only the key field is on the form.
Does that sound like the expected behavior?
Thanks!Great! Will you be pushing new code for this update?
Thanks!Hi Alex,
I am not using the “DFFS_Email” list and workflow, just using a rule to trigger the email. With the multi select people picker, the email sends if there is only one name in the field. As soon as I add a second name, I get the invalid email error mentioned above. I have tried this on two test sites just to confirm the error. Also I did confirm that both people have valid emails. Any thoughts?
Thanks.If you allow multiple names in the people picker, is it possible to send both people the email? I seem to be getting the same error “The email message cannot be sent. make sure the Email has a valid recipient”.
Thanks!You may disregard this question – I found the setup instructions for calendars.
That worked perfectly! I am not sure why the other lookup fields appeared to work originally but just to be safe I used this function on all lookup fields.
Thanks! PennyThis is my new code for the “save and edit” button. It is not saving any new or updated data, it is simply refreshing the original data. Thanks again!
function GoToEdit(){
spjs.dffs.data.requiredFields.push(“SalesID”);
data = {};
updateItem = spjs.utility.updateItem({“listName”:_spPageContextInfo.pageListId,”id”:spjs.dffs.data.thisItemID,”data”: data });
if(updateItem.success){location.href = location.href;
}else{alert(updateItem.errorText);} }- This reply was modified 8 years, 9 months ago by Penny Kingston.
Hi again,
This code works and appears to update the “title” field with the pre-defined text “New Title Value”. How could I make this work to update any and all changes to any fields within the form? (There is no way to pre define them.)
Thanks!Alex,
I am now trying to use the same code on the edit form to save and stay on the edit form. However, using the code above does not work because it tries to create a new item as opposed to saving the existing item. My guess is that I need to modify the newItem line:NewItem = spjs.utility.addItem({“listName”:_spPageContextInfo.pageListId,”data”:data});
I have seen “spjs.utility.addItem” and “spjs.utility.DeleteItem” used in your blogs, do you have a command to edit, save or update an item?
Thanks!Hi Alex,
I did have the field set as required but your line of code worked perfectly!
Many thanks!Hi Alex, I have used your code for saving and redirecting a form using the code below. It works great except that the required field of “SalesID” no longer seems to be required.
It appears that the code checks the field but there is no alert that forces someone to populate the field. Do you have any suggestions for making the salesID required using this code?
function GoToEdit(){
var ok = spjs.dffs.check_Mandatory([“SalesID”]),
data = {},
newItem,
url;
if(ok){
data.SalesID = getFieldValue(“SalesID”);
newItem = spjs.utility.addItem({“listName”:_spPageContextInfo.pageListId,”data”:data});
if(newItem.success){
url = location.pathname.substring(0,location.pathname.lastIndexOf(“/”)) + “/EditForm.aspx?ID=”+newItem.id;
if(GetUrlKeyValue(“IsDlg”)===”1″){
url += “&IsDlg=1”;
}
location.href = url;
}else{
alert(newItem.errorText);
}
}
}
function PreSaveAction(){
saveAndRedir();
}- This reply was modified 8 years, 9 months ago by Penny Kingston.
-
AuthorPosts