file upload issue

I have followed the direction to “Use the File Component to Attach Files to a Record”. If I leave as “deactivate this condition” “If no row or Source Model”, then all records regardless of the Parent ID (assume because it finds no matches, so it gives me all records) are presented and when I drag a file to upload the records shows.

If I change “If no row in source model” then the model shows no records as it should. However, if I drag a document to “File Upload” the record does not show in the table.

Bill,

Would you post pictures of your attachment model and your parent model.  Please also show us the model conditions on your attachment model.

Thanks,

Bill

Thanks Bill


Bill,

Thanks for the screenshots. I think there are 2 things that you want to do. In your attachment model (Attachment_CR) change the condition for the ParentId. You have it set for Parent.Id (Parent dot Id). I want you to set it to ‘ParentId’ as below.

The other thing I saw is that you do not load the A_Temp_Add_Task_CR__c model on page load. If this model has no data, then the Attachment model condition to filter by ParentId will be empty meaning that when it is set to ‘deactivate this condition’ the Attachment model will load ANY attachments that the user can see. As you have noted if you set the condition to ‘Abort if no rows in source model’, then nothing comes back since the A_Temp_Add_Task_CR__c is empty meaning there is no Id field to filter the Attachment model.

How are you intending to use the A_Temp_Add_Task_CR__c model? If this is for creating new records in the A_Temp_Add_Task_CR__c object then you will need to save the A_Temp_Add_Task_CR__c model before you can upload attachments. The ParentId on the Attachment model must be set to upload an attachment. There are some ways to work around this with JavaScript.

Thanks,

Bill

Thanks Bill. I have changed to the ParentId and I do create the record.


I made the changes. However, it looks like the ParentId is 15 digits long and the ID of A_Temp_Add_Task_CR__c is 18 digits. Is this a problem? If so, how to resolve

Bill,

It won’t be a problem.  Skuid will handle pulling the attachments using the 15 digit Id.

In your attachment model (Attachment_CR) change the Condition State to ‘Filterable Default On’.  Add a model action to your A_Temp_Add_Task_CR__c model.  The initiating action is ‘Model Saved’.  Add 2 actions:

  1. Activate and Set value of Model Condition of the ParentId on your Attachment_CR model.  Set the value to {{$Model.A_Temp_Add_Task_CR__c.data.0.Id}}.  Make sure that you have the ‘Id’ field returned in the A_Temp_Add_Task_CR__c model.
  2. Query the Attachment_CR model.
This will enable any attachments you upload to be ‘linked’ to the newly created record in A_Temp_Add_Task_CR__c.

Thanks,

Bill

Thanks Bill,

I believe I have set all as suggested.  The table shows blank as it should but no new record shows in the table below.  Here is a video to show how it does not work
https://drive.google.com/file/d/0B409lhd9sYDcaVMwRTNZem1Jc3M/view
Cheers,
Bill

Bill,

I just tried this in my dev org. I was able to get it working the way I was thinking it could work. I think the only thing I did differently is that did not load the attachment model on page load and set the parentid condition to default off.

Here is the XML of the page I tried this on. Maybe it can help you figure out what changes to make. This page creates a new task. It only uses standard objects. You will be fine to install it wherever.

Thanks,

Bill

models.saved New {{Model.label}} {{Model.labelPlural}} {{Name}} {{Model.label}} NewContact NewContact (function(skuid){ var $ = skuid.$; $(document.body).one('pageload',function(){ var myModel = skuid.model.getModel('Task'); //var myComponent = skuid.component.getById('MyComponentUniqueId'); var row = myModel.getFirstRow(); myModel.updateRow(row, {ActivityDate:''}); }); })(skuid);