Hi,
Thanks for yoyu advise Yadnyesh and Tim.
I wanted to use a plugin . I wrote it but ı gut profiler erro int the statement service.create();
Now using javascrpt i got the ids form multiline textbox one by one. When i came to the save pert noth,ing happens. the code loops again and again why i did not understant? Yadnyesh, i got the ids from a html web resource and sotre them in this form to multilinetex field. Anyway her is my javascript code; can anyone help me to save the records to the database, the save part does nto workinfg and the code loops again and again:
function OnSave() {
try {
alert(getCurrentEntity().getId());//it gives me nothing
var idler = getAttr("new_ids").getValue();//the ids of the child firms comes from the html web resource
var magazaadlari=getAttr("new_multiline").getValue();//the chid firm names of the child firms comes from the html web resource
var markalar = getAttr("new_markalar").getValue();//the brand numbers of the child firms comes from the html web resource
var id = [];
var magazaadi = [];
var marka = [];
//split from commas and stroe them to arrays
var id= idler.split(',');
var marka = markalar.split(',');
var magazaadi= magazaadlari.split(',');
//They are the form values
//They should be same for each child firm.
var tut = getAttr("new_tutar").getValue();
var faturatarihi = getAttr("new_faturatarihi").getValue();
var faturano = getAttr("new_faturano").getValue();
var calismaturu = getAttr("new_calismaturu").getValue();
var donem = getAttr("new_donem").getValue();
//the counter
var count=0;
count=magazaadi.length;
//The amount dvided by number of child firms
tut = tut / (count);
//counters
var t=0;
var i=0;
if (getAttr("new_ids").getValue() == null) return;//check for empty multiline text field
//trim the array
for (i = 0; i < count; i++)
{
id[i] = id[i].trim();
magazaadi[i] = magazaadi[i].trim();
marka[i] = marka[i].trim();
}
//The lookup field to select a child firm.
//This should only works
//When a child firm or child firms were not be selected from the html web resource.
//Since It is oriinally put in the form.
//I assign the values about the child firms from the multiline text fields one by one in a loop
var frmLookupField = getField("new_magaza");
for(t = 0; t < count; t++)
{
getAttr("new_faturatarihi").setValue(faturatarihi);
getAttr("new_faturano").setValue(faturano);
getAttr("new_calismaturu").setValue(calismaturu);
getAttr("new_donem").setValue(donem);
getAttr("new_tutar").setValue(tut);
frmLookupField.setValue(setLookupValue("new_magaza", id[t],magazaadi[t],"new_destek_yerelreklam_detay"));
if((count-1)==t)return;
//not working
Xrm.Page.data.entity.save();
}
} catch (e) { alert("OnLoad error:" + e.message); }
}