Check if you can ignore you TID/SID and get your pokemon instantly:PokGear Pokemon Receiver
Secret ID (SID) is a hidden ID of the trainer in Pokemon game. Trainer ID (TID) is the regular ID of the trainer which can be seen in Pokemon X,Y,OR,AS; but in Pokemon Sun Moon, it's hidden too.
And every pokemon in game has a SID and a TID. If the SID and the TID in a pokemon don't match the trainer's, the pokemon probably won't obey the trainer.
The stamps in the TRAINER PASSPORT will have affect on whether pokemon will obey trainer or not. Click here to learn more about trainer passport & stamps and whether you need to know the TID/SID or not.
In the Pokgear App, we provider a service to help regular users to find their SID (and TID too for Sun Moon users). Here's the process:
Click the Find my SID button at the bottom of the screen or in the editor screen(if you don't see the Find SID button at the bottom, go back to the app and go to main tab of create pokemon screen, click the "How to Get SID" button), then chose a time & date when you'll be available to trade pokemon using Link Trade in Pokemon sun/moon or the Player Search System (PSS) in Pokemon X,Y,OR,AS. Then fill in some info including your friend code to finish the Find SID order.
You'll see a trade partner's friend code when you finish the order. Add that friend code into your 3DS. It's very important! Otherwise you can't get it done.
At the trade time & date, log onto the Festival Plaza for Pokemon sun / moon (How to trade pokemon in sun moon) or PSS for X,Y,OR and AS. Wait for our trade request or send us a trade request.
When the trade starts, we'll send you a useless pokemon with the nickname 'Find SID'. Please send us a pokemon that was caught or hatched by yourself.
Please wait an hour, then you'll see your SID and TID (TID is for Pokemon Sun Moon only). You'll get a notification of the TID/SID if notification is enable for Pokgear App in your phone. Then you can click on TID/SID number to save them to the default trainer in the app.
Please refer How to trade pokemon in sun moon