# Updating reference object class on import

**URL:** <https://community.appfarm.io/t/updating-reference-object-class-on-import/533>\
**Category:** Ask the community\
**Created:** [June 15, 2023, 10:11am UTC](https://community.appfarm.io/t/updating-reference-object-class-on-import/533 "2023-06-15T10:11:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@saima](https://community.appfarm.io/u/saima)\
**Post date:** [June 15, 2023, 10:11am UTC](https://community.appfarm.io/t/updating-reference-object-class-on-import/533/1 "2023-06-15T10:11:54Z")

</div>

Hi, I’m having some issues to update the object class value on import. I have object class X which has a reference to object class Y & object class Z. Object class Y also has a reference to object class Z. The import file does not contain any information of object class z. I,m trying to update the value of object class Z through object class y before persisting the file but that is not working.

 ![p1](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/69694dadd5385fe3512b949317058dcfb619c5ca.png)

But if I persist the data & try to update the value of object class Z then values are updated.

 ![p2](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/284221165ff02afc5e432ef8cdadecdbb358edcc.png)

Is there a way i can update values on import?

---

<div class="post-metadata">

**Author:** ![Simona](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/simona/32/201_2.png) [@Simona](https://community.appfarm.io/u/Simona)\
**Post date:** [June 16, 2023, 6:05am UTC](https://community.appfarm.io/t/updating-reference-object-class-on-import/533/2 "2023-06-16T06:05:26Z")

</div>

Hi! I assume that your file contains the value of object class Y? When importing an object class value as a object reference you need to add a runtime only property to your data source X temp, which might be Y temp. Then map the Y column of your file to Y temp. Add an Update Object after your Import Data action node, to set the reference to Y. You can use update all objects in X temp and you have to use a function on the reference to Y for this: Add Y (which contains all Ys) as a Parameter and set a filter where X temp.Y = Y.(the value you would like to import) and return Y[0].\_id. Hope this will help 🙂

---

<div class="post-metadata">

**Author:** ![saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@saima](https://community.appfarm.io/u/saima)\
**Post date:** [June 16, 2023, 8:42am UTC](https://community.appfarm.io/t/updating-reference-object-class-on-import/533/3 "2023-06-16T08:42:39Z")

</div>

Yes, file contains value of object class y. I’m doing the same thing and it work.

I need help with updating the object class Z (file does not contain any information of object class Z). Object class Z has a reference to object class Y. I want to update the value of object class Z on import through object class Y. Can I do that?

Right now i’m updating the value of object class Z after persisting the file & it works perfectly. But I wanted to update the object class value before persisting the imported file.

---

<div class="post-metadata">

**Author:** ![Joanna](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/joanna/32/122_2.png) [@Joanna](https://community.appfarm.io/u/Joanna)\
**Post date:** [June 16, 2023, 10:05am UTC](https://community.appfarm.io/t/updating-reference-object-class-on-import/533/4 "2023-06-16T10:05:21Z")

</div>

Could you share a screenshot of how your action is set up?

---

<div class="post-metadata">

**Author:** ![saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@saima](https://community.appfarm.io/u/saima)\
**Post date:** [June 16, 2023, 3:03pm UTC](https://community.appfarm.io/t/updating-reference-object-class-on-import/533/5 "2023-06-16T15:03:04Z")

</div>

![license](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/6a9d9e4237d204a98606a028a3bdd8b735dded64.png)  
Here is the action.  
I want to update the license information before persist action node. License don’t have a direct connection with the platform (import file) but Field do have. So trying to update the license information from field data on import.

The action in the screenshot is updating the license information but after persisting the file.  
I hope that makes it a bit clear now.

---

<div class="post-metadata">

**Author:** ![kristian](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/kristian/32/58_2.png) [@kristian](https://community.appfarm.io/u/kristian)\
**Post date:** [June 16, 2023, 6:24pm UTC](https://community.appfarm.io/t/updating-reference-object-class-on-import/533/6 "2023-06-16T18:24:00Z")

</div>

Hi Saima.

Based on the screenshot, it seems as you are updating the platform objects, and setting the reference to Field correctly (before the persist).

Moving to your next question. At this point (before the persist) you have a datasource with correct references to corresponding field. I guess the problem is that you want update all platforms, setting the property platform.license = platform.field.license?  
If that’s the case, add a new **Update Objects** (of `platform (import)`), setting `platform.license` the following way using the Function editor:

1. Add `license` as Function parameter, by adding that data source and filter it by `license.id = platform(import).license.`
2. `if (license.length>0) return license[0].field`

Hope that helps!

---

<div class="post-metadata">

**Author:** ![saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@saima](https://community.appfarm.io/u/saima)\
**Post date:** [June 23, 2023, 1:16pm UTC](https://community.appfarm.io/t/updating-reference-object-class-on-import/533/7 "2023-06-23T13:16:03Z")

</div>

Thanks @kristian, I’ll try that.
