HI,

AttachFile is a system button, Actually inside that button bydefault It is having this function "Mscrm.RibbonActions.addFileToRecord".
What my requirement is i want to call this function into my custom button.
I wrote script like this
function addFileToRecordd() {
var addfile = Mscrm.RibbonActions.addFileToRecord;
addfile();
}
when i click on that button then i am able to open window. But inside that window url i am getting following errors.
https://xxxxxxxx.dynamics.com/_common/error/errorhandler.aspx?BackUri=&ErrorCode=0x80040216&Parm0=%0d%0a%0d%0aError%20Details%3a%20Parent%20Type%20passed%20in%20the%20Query%20String%20must%20be%20an%20integer.&RequestUri=%2fnotes%2fedit.aspx%3fhideDesc%3d1%26pId%3d%26pType%3d&user_lcid=1033
If I passed the ParrentId and Parrenttypecode then also i am getting following error.
https:/xxxxxxxx.dynamics.com/_common/error/errorhandler.aspx?BackUri=&ErrorCode=&Parm0=%0d%0a%0d%0aError%20Details%3a%20An%20unhandled%20exception%20occurred%20during%20the%20execution%20of%20the%20current%20web%20request.%20Please%20review%20the%20stack%20trace%20for%20more%20information%20about%20the%20error%20and%20where%20it%20originated%20in%20the%20code.&RequestUri=%2fnotes%2fedit.aspx%3fhideDesc%3d1%26pId%3d10006%26pType%3dCE3FEA85-C0E3-E211-8BF4-984BE173039D&user_lcid=1033.
I dont know why it happens, If any one knows the solution please let me know.
Thanks in advance,
Sravan J