<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Reset OData entity changes with Mobile Development Kit possible? in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/reset-odata-entity-changes-with-mobile-development-kit-possible/qaa-p/12398670#M4640352</link>
    <description>&lt;P&gt;Hi Jitendra,&lt;/P&gt;&lt;P&gt;this is the proper Action I was searching for. &lt;/P&gt;&lt;P&gt;Is there also a functionality to retrieve all entities with pending changes?&lt;/P&gt;&lt;P&gt;For example there is a functionality which retrieves the following Offline OData entities with pending changes (UPDATE, CREATE, DELETE):&lt;/P&gt;&lt;UL&gt;
 
&lt;LI&gt;OrderSet('ID1')&lt;/LI&gt; 
&lt;LI&gt;OrderSet('ID2')&lt;/LI&gt; 
&lt;LI&gt;DefectSet('ID1')&lt;/LI&gt; 
&lt;LI&gt;CheckListItemSet('ID1')&lt;/LI&gt; 
&lt;LI&gt;CheckListItemSet('ID2')&lt;/LI&gt; 
&lt;LI&gt;CheckListItemSet('ID3')&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;With this list of entities I will process for each entity the Action &lt;A rel="nofollow" href="https://help.sap.com/doc/69c2ce3e50454264acf9cafe6c6e442c/Latest/en-US/docs-en/reference/schemadoc/Action/OfflineOData/UndoPendingChanges.schema.html"&gt;UndoPendingChanges&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jul 2021 13:04:27 GMT</pubDate>
    <dc:creator>former_member679164</dc:creator>
    <dc:date>2021-07-15T13:04:27Z</dc:date>
    <item>
      <title>Reset OData entity changes with Mobile Development Kit possible?</title>
      <link>https://community.sap.com/t5/technology-q-a/reset-odata-entity-changes-with-mobile-development-kit-possible/qaq-p/12398668</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
  &lt;P&gt;it is possible to reset changes of an OData OfflineStore Entity while working with the Mobile Development Kit?&lt;/P&gt;
  &lt;P&gt;For example, there is a OData OfflineStore Entity called "Order" and there are changes of this entity. Now the editor of the entity will reset the changes of the entity "Order" before synchronizing the OData OfflineStore. Is there a Mobile Development Kit OData Action type or &lt;A href="https://help.sap.com/doc/69c2ce3e50454264acf9cafe6c6e442c/Latest/en-US/docs-en/index.html"&gt;API&lt;/A&gt; functionality to archieve this?&lt;/P&gt;
  &lt;P&gt;Maybe you can help me.&lt;/P&gt;
  &lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 06:51:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/reset-odata-entity-changes-with-mobile-development-kit-possible/qaq-p/12398668</guid>
      <dc:creator>former_member679164</dc:creator>
      <dc:date>2021-07-15T06:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Reset OData entity changes with Mobile Development Kit possible?</title>
      <link>https://community.sap.com/t5/technology-q-a/reset-odata-entity-changes-with-mobile-development-kit-possible/qaa-p/12398669#M4640351</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;thomasschilling&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Do you want to undo the local changes done against "Order" entity? &lt;/P&gt;&lt;P&gt;If so, you can use &lt;A href="https://help.sap.com/doc/69c2ce3e50454264acf9cafe6c6e442c/Latest/en-US/docs-en/reference/schemadoc/Action/OfflineOData/UndoPendingChanges.schema.html" target="_blank"&gt;Offline OData UndoPendingChanges action&lt;/A&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 12:43:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/reset-odata-entity-changes-with-mobile-development-kit-possible/qaa-p/12398669#M4640351</guid>
      <dc:creator>Jitendra_Kansal</dc:creator>
      <dc:date>2021-07-15T12:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Reset OData entity changes with Mobile Development Kit possible?</title>
      <link>https://community.sap.com/t5/technology-q-a/reset-odata-entity-changes-with-mobile-development-kit-possible/qaa-p/12398670#M4640352</link>
      <description>&lt;P&gt;Hi Jitendra,&lt;/P&gt;&lt;P&gt;this is the proper Action I was searching for. &lt;/P&gt;&lt;P&gt;Is there also a functionality to retrieve all entities with pending changes?&lt;/P&gt;&lt;P&gt;For example there is a functionality which retrieves the following Offline OData entities with pending changes (UPDATE, CREATE, DELETE):&lt;/P&gt;&lt;UL&gt;
 
&lt;LI&gt;OrderSet('ID1')&lt;/LI&gt; 
&lt;LI&gt;OrderSet('ID2')&lt;/LI&gt; 
&lt;LI&gt;DefectSet('ID1')&lt;/LI&gt; 
&lt;LI&gt;CheckListItemSet('ID1')&lt;/LI&gt; 
&lt;LI&gt;CheckListItemSet('ID2')&lt;/LI&gt; 
&lt;LI&gt;CheckListItemSet('ID3')&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;With this list of entities I will process for each entity the Action &lt;A rel="nofollow" href="https://help.sap.com/doc/69c2ce3e50454264acf9cafe6c6e442c/Latest/en-US/docs-en/reference/schemadoc/Action/OfflineOData/UndoPendingChanges.schema.html"&gt;UndoPendingChanges&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 13:04:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/reset-odata-entity-changes-with-mobile-development-kit-possible/qaa-p/12398670#M4640352</guid>
      <dc:creator>former_member679164</dc:creator>
      <dc:date>2021-07-15T13:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Reset OData entity changes with Mobile Development Kit possible?</title>
      <link>https://community.sap.com/t5/technology-q-a/reset-odata-entity-changes-with-mobile-development-kit-possible/qaa-p/12398671#M4640353</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;thomasschilling&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;UndoPendingChanges action can only undo 1 entity at a time, so it's up to application how you want to handle undoing the pending changes for more than one entity and also for other entitysets.&lt;BR /&gt;You can leverage&lt;STRONG&gt; @sap.isLocal&lt;/STRONG&gt; property from the Offline OData to understand the state of the record in an EntitySet, it is set to &lt;STRONG&gt;true&lt;/STRONG&gt; when record was created/updated locally and has not been synced to the backend yet. &lt;/P&gt;&lt;P&gt;for example, in a Customers list page, i am updating an existing record and also creating a new one, i can call this rule on the list page that will loop through each customer items (have been locally created and updated) and undo the changes. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
export default function UndoAllChanges(context) {
    return context.read('/MyTestingApp/Services/SampleServiceV2.service', 'Customers', [], `$filter=sap.islocal()`).then((results) =&amp;gt; {
        if (results &amp;amp;&amp;amp; results.length &amp;gt; 0) {
            console.log("length" + results.length);
            let promiseList = [];
            results.forEach(item =&amp;gt; {
                console.log("Item" + item);
                let updatePromise = context.executeAction({
                    "Name": "/MyTestingApp/Actions/Customers/UndoLocalChanges.action",
                    "Properties": {
                        "Target": {
                            "EditLink": item['@odata.readLink']
                        }
                    }
                })
                promiseList.push(updatePromise);
            });
            Promise.all(promiseList).then(() =&amp;gt; {
                message = `undo local changes worked fine`
                return context.executeAction({
                    "Name": "/MyTestingApp/Actions/GenericToastMessage.action",
                    "Properties": {
                        "Message": message

                    }
                })
            })
        }
        else {
            message = `No local changes available`;
            return context.executeAction({
                "Name": "/MyTestingApp/Actions/GenericToastMessage.action",
                "Properties": {
                    "Message": message
                }
            });
        }
    });
}
&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;For undoing a deleted entity, you can first store it's readLink e.g. in ClientData once item has been deleted and then execute undoing it in a rule. &lt;BR /&gt;You can follow this approach for other EntitySet(s) and can handle doing for all in a single rule.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 10:42:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/reset-odata-entity-changes-with-mobile-development-kit-possible/qaa-p/12398671#M4640353</guid>
      <dc:creator>Jitendra_Kansal</dc:creator>
      <dc:date>2021-07-29T10:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Reset OData entity changes with Mobile Development Kit possible?</title>
      <link>https://community.sap.com/t5/technology-q-a/reset-odata-entity-changes-with-mobile-development-kit-possible/qaa-p/12398672#M4640354</link>
      <description>&lt;P&gt;Hello  &lt;SPAN class="mention-scrubbed"&gt;jitendrakumar.kansal&lt;/SPAN&gt; I'm a bit confuse because  &lt;SPAN class="mention-scrubbed"&gt;bill.froelich&lt;/SPAN&gt; in this question:&lt;/P&gt;&lt;P&gt; &lt;A href="https://answers.sap.com/questions/13292120/mdk-exception-attempting-to-update-a-downloaded-en.html" target="test_blank"&gt;https://answers.sap.com/questions/13292120/mdk-exception-attempting-to-update-a-downloaded-en.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;talked about sap.isLocal and sap.hasPendingChanges properties.&lt;/P&gt;&lt;P&gt;According to  &lt;SPAN class="mention-scrubbed"&gt;bill.froelich&lt;/SPAN&gt; explanation, only property sap.hasPendingChanges is true when entity is updated locally: &lt;/P&gt;&lt;P&gt;"So for a newly created record both @sap.isLocal and @sap.hasPendingChanges will be true. For a downloaded record that has been updated only @sap.hasPendingChanges would be true."&lt;/P&gt;&lt;P&gt;However in your post:&lt;/P&gt;&lt;P&gt;"You can leverage&lt;STRONG&gt; @sap.isLocal&lt;/STRONG&gt; property from the Offline OData to understand the state of the record in an EntitySet, it is set to &lt;STRONG&gt;true&lt;/STRONG&gt; when record was created/updated locally and has not been synced to the backend yet."&lt;/P&gt;&lt;P&gt;Can you clear up this please ?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kiko&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 22:28:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/reset-odata-entity-changes-with-mobile-development-kit-possible/qaa-p/12398672#M4640354</guid>
      <dc:creator>fjcarrasco</dc:creator>
      <dc:date>2021-07-29T22:28:28Z</dc:date>
    </item>
  </channel>
</rss>

