Adding a record to another form
- form Add_New_Course_Details
{
displayname = "Add New Course Details"
success message = "Data Added Successfully!"
field alignment = top
column
{
must have Format
(
type = picklist
values = {"Self-Video", "Self-Written", "Group", "One-on-one"}
width = 206px
)
unique Course_Title
(
displayname = "Course Title"
type = text
width = 200px
)
Course_Track
(
displayname = "Course Track"
type = picklist
values = Add_A_Course_Track.Course_Track_Name
allow new entries = true
[
displayname = "Add A Course Track"
]
width = 206px
)
lookup_instructor
(
displayname = "Instructor"
type = picklist
values = Instructors.Instructor
allow new entries = true
[
displayname = "Add New Instructor"
]
width = 206px
)
Course_Description
(
displayname = "Course Description"
type = textarea
height = 100px
width = 200px
)
Ref_Doc
(
displayname = "Reference Documnets"
type = url
width = 140px
)
}
column
{
Course_Duration
(
displayname = "Course Duration"
type = text
width = 200px
)
Related_Courses
(
displayname = "Related Courses"
type = text
width = 200px
)
Start_Date
(
displayname = "Course Start Date"
type = date
width = 130px
)
Course_End_Date
(
displayname = "Course End Date"
type = date
width = 130px
)
must have Video_Link
(
displayname = "Video Link"
type = url
width = 400px
)
Get_User_Data
(
displayname = "Get User Data"
type = picklist
private = true
values = Add_Course_Registration[Course_Title == Course_Title].User
width = 206px
)
}
actions
{
on add
{
on load
{
clear Get_User_Data;
Get_User_Data_Unique_List = List();
for each UserRec in Add_Course_Registration [(User is not null)]
{
if (!Get_User_Data_Unique_List.contains(UserRec.User))
{
Get_User_Data_Unique_List.add(UserRec.User);
Get_User_Data:ui.add(UserRec.User);
}
}
}
Submit
(
type = submit
displayname = "Submit"
PreSubmit = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><preoncommit><successmsg><type><![CDATA[sucmsgtimeout]]></type><value><![CDATA[Data Added Successfully!]]></value><timeout><![CDATA[2]]></timeout></successmsg><openurl/></preoncommit>\n"
on success
{
for each UserRec in Add_New_Course_Details [Get_User_Data != "-Select-"]
{
addregistrationrecord = insert into Add_Course_Registration
[
Added_User = zoho.loginuser
Completion_Status = "Not Complete"
Course_Title = "input.Course_Title"
Course_Track = "input.Course_Track"
Instructor = "input.lookup_instructor"
Registration_Status = "Not Registered"
User = "UserRec.User"
Video_Link = "input.Video_Link"
];
}
}
)
Reset
(
type = reset
displayname = "Reset"
)
}
on edit
{
Update
(
type = submit
displayname = "Update"
)
Cancel
(
type = cancel
displayname = "Cancel"
)
}
}
}
I'm helping a client develop an application. I'm expecting this form to add records to the "Add_Course_Registration" form for each user listed in the "Get_User_Data" field (which I've configured to sort each unique user using the on load section of the form). I seem to be missing something, but the form doesn't give me an error since the script is good, but It also doesn't add the record to the other form as intended.
I've been tinkering with this for some time changing values here and there, but I'm just missing something. Anyone got any ideas?