You need to sign in to do that
Don't have an account?

Record ID is Saving in Custom Field 'Name'
Controller:
public class reqfields {
Registration__c c=new Registration__c();
Public ID idd {get; set;}
public Attachment attachment {
get {
if (attachment == null)
attachment = new Attachment();
return attachment;
}
set;
}
public PageReference Save(){
insert c;
idd=c.id;
Attachment a = new Attachment(parentid = idd, name=attachment.name, body = attachment.body);
insert a;
return new ApexPages.StandardController(c).view();
}
public reqfields(ApexPages.StandardController Controller) {
}
}
Dont mind, I'm unable to provide in nice format...
but Plz let me know how to save the record along with the uploaded document.
Note: Record id is saving in custom field Name.
Are you receiving an error or are you asking why there isn't an error?
I'm not recieving any error when inserting the record, but the problem is that Name field is filled up with record id rather than the actual name of the record.
So I want to insert a record with the appropriate name of the record (rather than the record id).